web
You’re offline. This is a read only version of the page.
close
Skip to main content
Community site session details

Community site session details

Session Id :
Microsoft Dynamics GP (Archived)

Report Writer calculated field for "contains"

(0) ShareShare
ReportReport
Posted on by

I need to create a calculated field for several SOP forms.  This will be a conditional field which will print a worded message if our SOP number CONTAINS the letter "B".  

I can get it to print if the SOP number ENDS with the letter "B" but I cannot seem to get it to print if it "contains" the letter "B" as in "B.01" or B.11" etc.....  Please help.

*This post is locked for comments

I have the same question (0)
  • Verified answer
    David Musgrave MVP GPUG All Star Legend Moderator Profile Picture
    14,069 Most Valuable Professional on at
    RE: Report Writer calculated field for "contains"

    Hi Pam

    You need to use the User Defined RW functions in the System Series.

    There are RW_Left() and RW_Right() and RW_Substring() which can be used to grab specific characters in a string, assuming you are always looking for the first or last or X character in a string.

    However, for a contains search you need

    RW_Pos()

    function returns integer OUT_pos;

    in string IN_target; { The string you want to search in }

    in string IN_search; { The string you want to search for }

    in integer IN_start; { The position at which the search will start in the target string }

    If the number returned is > 0 then the character you are looking for exists. For Example:

    IF: RW_Pos('SOP Number'  "B"  1) > 0

    TRUE: "Found"

    FALSE: "Not Found"

    For more information see my blog post:

    blogs.msdn.com/.../using-the-built-in-report-writer-functions.aspx

    David

  • Suggested answer
    Community Member Profile Picture
    on at
    RE: Report Writer calculated field for "contains"

    Hi Pam,

    As David mentioned, using User defined RW functions we can develop our own custom functions based on the requirement.

  • baxter05 Profile Picture
    on at
    RE: Report Writer calculated field for "contains"

    David,

    Thank you for the detailed information.  Using the RW_POS was what I needed to do and I had been attempting that but I did not have the information within the () correct.  

    Your blog post is one that I have read at least a dozen times as I have found it helpful.  However, I am a little slow in understanding as some of the Report Writer information, functions etc seem like Greek to me.

    I am neither a programmer, or a developer, and it does slow me down.

    Thank you again for your assistance,

    Pam

  • David Musgrave MVP GPUG All Star Legend Moderator Profile Picture
    14,069 Most Valuable Professional on at
    RE: Report Writer calculated field for "contains"

    Hi Pam

    Glad I could help.

    David

  • Community Member Profile Picture
    on at
    RE: Report Writer calculated field for "contains"

    I have a similar situation but cannot figure out how to write the calculated field

    If the item number contains -SN

    true would be blank

    false would be print item no

    on the Blank sales order

  • Suggested answer
    David Musgrave MVP GPUG All Star Legend Moderator Profile Picture
    14,069 Most Valuable Professional on at
    RE: Report Writer calculated field for "contains"

    Hi Wendy

    It would need to be something like this

    IF: RW_Pos(SOP_LINE_WORK.'Item Number'  "-SN"  1) > 0

    TRUE: ""

    FALSE: SOP_LINE_WORK.'Item Number'

    The true case is an empty string constant

    Hope this helps

    David

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Abhilash Warrier – Community Spotlight

We are honored to recognize Abhilash Warrier as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics GP (Archived)

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans