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

Announcements

No record found.

News and Announcements icon
Community site session details

Community site session details

Session Id :
Finance | Project Operations, Human Resources, ...
Answered

SOP Blank History Invoice Form - rw_SelectAddrLine

(1) ShareShare
ReportReport
Posted on by 41
Good Afternoon Everyone,
I’m a bit confused about how to correctly add Address 3 to the form.

Currently, the form uses calculated fields with the rw_SelectAddrLine function for the Bill To address lines:

Bill To Address Line 1
Bill To Address Line 2
Bill To Address Line 3
Bill To Address Line 4

Each line is using the same FUNCTION_SCRIPT(rw_SelectAddrLine1 …) logic pulling from:

Bill To Address Line 1 = FUNCTION_SCRIPT(rw_SelectAddrLine1""RM_Customer_MSTR_ADDR.Address 1RM_Customer_MSTR_ADDR.Address 2""""RM_Customer_MSTR_ADDR.CityRM_Customer_MSTR_ADDR.StateRM_Customer_MSTR_ADDR.ZipRM_Customer_MSTR.Country
Bill To Address Line 2 = FUNCTION_SCRIPT(rw_SelectAddrLine1""RM_Customer_MSTR_ADDR.Address 1RM_Customer_MSTR_ADDR.Address 2""""RM_Customer_MSTR_ADDR.CityRM_Customer_MSTR_ADDR.StateRM_Customer_MSTR_ADDR.ZipRM_Customer_MSTR.Country
Bill To Address Line 3 = FUNCTION_SCRIPT(rw_SelectAddrLine1""RM_Customer_MSTR_ADDR.Address 1RM_Customer_MSTR_ADDR.Address 2""""RM_Customer_MSTR_ADDR.CityRM_Customer_MSTR_ADDR.StateRM_Customer_MSTR_ADDR.ZipRM_Customer_MSTR.Country
Bill To Address Line 4 = FUNCTION_SCRIPT(rw_SelectAddrLine1""RM_Customer_MSTR_ADDR.Address 1RM_Customer_MSTR_ADDR.Address 2""""RM_Customer_MSTR_ADDR.CityRM_Customer_MSTR_ADDR.StateRM_Customer_MSTR_ADDR.ZipRM_Customer_MSTR.Country
 
Here’s what’s happening:

If the address card has a value in Address 1 and no value in Address 2, everything works correctly:
Address Line 1 = XXXXX
Address Line 2 = City, State, Zip
Address Line 3 = Country

However, if Address 2 has a value, the Country no longer prints:
Address Line 1 = XXXXX
Address Line 2 = YYYYYY
Address Line 3 = City, State, Zip

I’m not fully understanding how the rw_SelectAddrLine function determines which fields print on each line. I’ve searched online but am still unclear on the logic.
 
Our goal is for the form to display:
Address 1
Address 2 (if there is a value)
Address 3 (if there is a value)
City, State, Zip
Country
 
If anyone can help clarify how rw_SelectAddrLine works and how we can properly include Address 3, I would really appreciate it.
Thank you.
 
 
Categories:
I have the same question (0)
  • Suggested answer
    Lisa at AonC.com Profile Picture
    1,062 Super User 2026 Season 1 on at
    It's a little tricky to verify with the line wrapping.  I think you need to adjust for each line like this:

     

    Here is a post on the function:    
  • TP-11040155-0 Profile Picture
    41 on at
    Thank you Lisa,
    This is what I Currently have now:
     
    Address Line 1 = Function_Script( rw_SelectAddLine 1, "", Address1, Address2, Address3, "", City, State, Zip, Country)
    Address Line 2 = Function_Script( rw_SelectAddLine 2, "", Address1, Address2, Address3, "", City, State, Zip, Country)
    Address Line 3 = Function_Script( rw_SelectAddLine 3, "", Address1, Address2, Address3, "", City, State, Zip, Country)
    Address Line 4 = Function_Script( rw_SelectAddLine 4, "", Address1, Address2, Address3, "", City, State, Zip, Country)

     I use commas for readability sake in this post, but in Report Writer these do not exist between each parameter of the function script

    My Test Customer Card has
    123 Address Line 1
    Tower C Line 2
    Suite 400 Line 3
    Clifton, NJ 07013
    United State
     
    what prints out is:
     
    123 Address Line 1
    Tower C Line 2
    Suite 400 Line 3
    United State
     
    It's missing the City State Zip Line
     
    When I replace the Country parameter with "" (Space) in the function. The last line is blank

    I only get
    123 Address Line 1
    Tower C Line 2
    Suite 400 Line 3
     
    we are currently on 2028.3 of GP. Is there a bug or an issue with the function rw_SelectAddLine that anyone knows of.

    Thank you,
  • Verified answer
    David Musgrave MVP GPUG All Star Legend Moderator Profile Picture
    14,137 Most Valuable Professional on at
    Hi
     
    I used the Runtime Execute window in GP Power Tools to create a quick test of the RW function rw_SelectAddrLine and it works fine.
     
    Please note that if you want to display the full address for the example you gave, you will need to have 5 calculated fields as there are a total of 5 lines.
     
    Here is the example code:
     
    local string Name;
    local string Address1;
    local string Address2;
    local string Address3;
    local string Address4;
    local string City;
    local string State;
    local string Zip;
    local string Country;
    local text l_text;
     
    Name = "";
    Address1 = "123 Address Line 1";
    Address2 = "Tower C Line 2";
    Address3 = "Suite 400 Line 3";
    Address4 = "";
    City = "Clifton";
    State = "NJ";
    Zip = "07013";
    Country = "United States";
     
    clear l_text;
    l_text = l_text + rw_SelectAddrLine(1, Name, Address1, Address2, Address3, Address4, City, State, Zip, Country) + char(13);
    l_text = l_text + rw_SelectAddrLine(2, Name, Address1, Address2, Address3, Address4, City, State, Zip, Country) + char(13);
    l_text = l_text + rw_SelectAddrLine(3, Name, Address1, Address2, Address3, Address4, City, State, Zip, Country) + char(13);
    l_text = l_text + rw_SelectAddrLine(4, Name, Address1, Address2, Address3, Address4, City, State, Zip, Country) + char(13);
    l_text = l_text + rw_SelectAddrLine(5, Name, Address1, Address2, Address3, Address4, City, State, Zip, Country) + char(13);
     
    warning l_text;
     
    Here is the displayed result.
     
    123 Address Line 1
    Tower C Line 2
    Suite 400 Line 3
    Clifton NJ    07013
    United States
     
    It is working as expected, I would suggest that there is something not quite correct in your calculated fields.  If you export the report as a package, you might find it easier to see in Notepad.exe.
     
    Also, when editing a calculated field, In the Expressions section, click on the Calculated or Conditional prompt to show the calculated field in full without needing to scroll left and right.
     
    PS: The code in this RW function has not been changed since it was created in March 2021.
     
    Kind regards
     
    David
  • TP-11040155-0 Profile Picture
    41 on at
    Thank you David and Lisa.

    Thank you David for the helpful tips.
     
     

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Stars!

Meet the Microsoft Dynamics 365 Contact Center Champions

We are thrilled to have these Champions in our Community!

Congratulations to the March Top 10 Community Leaders

These are the community rock stars!

Leaderboard > Finance | Project Operations, Human Resources, AX, GP, SL

#1
Giorgio Bonacorsi Profile Picture

Giorgio Bonacorsi 658

#2
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 468 Super User 2026 Season 1

#3
Syed Haris Shah Profile Picture

Syed Haris Shah 333 Super User 2026 Season 1

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans