Report Writer

Report Writer

Open the report in Report Writer, then follow the steps below to add a Calculated Field to your report.

The two Report Writer functions you can use are:

rw_TableLineCurrency

rw_TableLineString

They have the same input parameters.  One returns a string value, the other returns a currency value.  The input parameters are:

Product ID: this will always be 4600 (the Product ID for CTK)

String-1: (Up to 255 characters)

String-2: (Up to 255 characters)

Integer: (-32768 to +32767)

Currency-1: (-99,999,999,999,999.99999 to +99,999,999,999,999.99999)

Currency-2: (-99,999,999,999,999.99999 to +99,999,999,999,999.99999)

Integer Control: this must correspond to the @iCtrl value created earlier in the stored procedure.  For example, 1 = Item UDF1, 2 = Item UDF2.

Pro Tip: the input parameter datatypes are strictly enforced.  A common issue occurs when working with Line Numbers.  Some GP line numbers are long integers and some are currency.  Report Writer will give an error if a long integer is passed in to one of the currency fields.  A long integer must first be converted to a currency before being passed in to the currency parameter.  This is done by creating a calculated field (i.e. cLineNum) where the Result Type = Currency, and the Expression contains only the long integer field.

Create a new Calculated Field.  Name it and select Result Type = String.

//willoware.com/wp-content/uploads/2017/02/REX4.png

Select Core = System, Function = rw_TableLineString.  Click ADD.

//willoware.com/wp-content/uploads/2017/02/REX5.png

Product ID: Select Constants >> Type = Integer, Constant = 4600.  Click ADD

//willoware.com/wp-content/uploads/2017/02/REX6.png

String 1: The remaining fields are specific to this example.  You will need to provide either fields from the report tables, or default values.  In this case, we are adding ‘Item Number’ from the Item Master.

//willoware.com/wp-content/uploads/2017/02/REX7.png

String 2: In this example, String-2 is not used, so an “empty” string must be provided.  Select Constants >> Type = String, leave the Constant field empty, click ADD.

//willoware.com/wp-content/uploads/2017/02/REX8.png

Integer: In this example, Integer is not used.  This field is often used for Document Type.  Select Constants >> Type = Integer, Constant = 0, click ADD.

//willoware.com/wp-content/uploads/2017/02/REX9.png

Currency-1: In this example, Currency-1 is not used.  This field is often used for a Line Number.  Select Constants >> Type = Currency, Constant = 0.0000, click ADD.

//willoware.com/wp-content/uploads/2017/02/REX10.png

Currency-2: In this example, Currency-2 is not used.  This field is often used for a second Line Number, such as the SOP Line Component Sequence field.  Select Constants >> Type = Currency, Constant = 0.0000, click ADD.

//willoware.com/wp-content/uploads/2017/02/REX11.png

Integer Control: This field is critical.  The integer control is fed into @iCtrl in the stored procedure, so this field is ultimately controls what data is returned to the calculated field.  Select Constants >> Type = Integer, Constant = 1 (or your control integer), click ADD.

Click OK to save the Calculated Field, then add it to the report.