How to avoid duplicate string concatenation in X++ dynamics AX 2012 R2

Yesterday one of my colleague was facing duplicate string concatenation issue need to avoid duplicate string concatenation.

Problem:

Need to show bill of lading numbers for invoices against a specific Sales order, in this case we were facing duplicate BOLs issue that was being shown on report header

Situation:

To avoid the duplication of BOLs in concatenated string we have used the string function “strScan that take the string variable in which we are trying to concat the All BOL’s that need to be populated on report header and the current BOL that is being concate with string .

Following code is used to avoid duplicate concatenation of string:

if(!strScan(billOfLading, pickInHeader.BillOfLading,1,strLen(billOfLading)))

{

billOfLading += #Comma + pickInHeader.BillOfLading;

}

Note: The string function “strScanonly works with same length of string concatenation

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s