Merge City, State and Zip

I’m trying to merge these fields on a report via the example in the manual without success. The example in the manual is very difficult to make out. This is the code that I have imput for the script:

xrLabel5.Text = string.Format|“(0) , (1) (2)”, GetCurrentColumnValue|“LT_Address_Label_City”|,
GetCurrentColumnValue|“LT_Address_Label_StateProv”|,
GetCurrentColumnValue|“LT_Address_Label_Postal”||;

This is the error report that I get when I do a preview:

There are following errors in script(s):
xrLabel5.OnBeforePrint, line 3: error CS1002: ; expected
xrLabel5.OnBeforePrint, line 3: error CS1525: Invalid expression term ‘,’
xrLabel5.OnBeforePrint, line 3: error CS1002: ; expected
xrLabel5.OnBeforePrint, line 3: error CS1525: Invalid expression term ‘,’
xrLabel5.OnBeforePrint, line 3: error CS1002: ; expected
xrLabel5.OnBeforePrint, line 4: error CS1525: Invalid expression term ‘,’
xrLabel5.OnBeforePrint, line 4: error CS1002: ; expected
xrLabel5.OnBeforePrint, line 5: error CS1525: Invalid expression term ‘;’
xrLabel5.OnBeforePrint, line 5: error CS1002: ; expected

What have I missed?

Thanks,
Dan

Hi Dan

Your script needs to include all as shown in the AyaNova v3 Manual tutorial - private void OnBeforePrint, parenthesis, semicolon’s etc

You are also using ( ) around the numbers that identify the fields instead of the { } symbols, and your script also has | symbols in it which are not used as symbols in C#.

Note also the ( that is right after xrLabel5.Text = string.Format; and note the ) at the very end

When you select the OnBeforePrint property for your field xrLabel5, please confirm that the entire script is as follows :

private void OnBeforePrint(object sender, System.Drawing.Printing.PrintEventArgs e)
{
xrLabel5.Text = string.Format("{0} , {1} {2}", GetCurrentColumnValue(“LT_Address_Label_City”), GetCurrentColumnValue(“LT_Address_Label_StateProv”), GetCurrentColumnValue(“LT_Address_Label_Postal”));
}

In addition to the screenshot in the AyaNova v3 Manual, as identified in the tutorial, also look at the script in the sample report template Detailed Complete Service Workorder which has this exact script in it.

If you continue to get an error, confirm the property OnBeforePrint

If you continue to get an error, copy the entire script from OnBeforePrint to your reply.

Let me know this works for you now.

Thanks Joyce, it was the symbols!