RW: Using the rw_TableLineString() and rw_TableLineCurrency() Report Writer functions

When Microsoft Dynamics GP 9.0 was released, it included six new global functions specifically added to make life easier for ISVs (Independent Software Vendors).
These six placeholder functions were added so that Dexterity developers could trigger against them and use the functions to get their custom data on to reports without needing to create alternate reports.
Before these functions existed, a developer could create a Report Writer function in their dictionary which could return the additional data required. However, as the RW function was only in the third party dictionary, it could only be used if the report was also in the same third party dictionary… as an alternate report.
With the addition of these six placeholder functions, a developer could now trigger on the functions in the core Dynamics dictionary and their code could now return the data to any report in any product as core Dynamics RW functions are available to use in a calculated field from the Report Writer for any product dictionary.
The details of these functions is covered in the following KB Article. The KB article covers how developers can use the functions in their code:
Note: The article is currently unavailable, so I am attaching an archived version to the bottom of this post.
The added report writer user defined functions (in the system series) are listed below:
- rw_ReportStart()
- rw_ReportEnd()
- rw_TableHeaderString()
- rw_TableHeaderCurrency()
- rw_TableLineString()
- rw_TableLineCurrency()
This article covers an issue which using the rw_TableLineString() and rw_TableLineCurrency() report writer functions from the Report Writer.
The parameter list for these two functions is the same with the data being returned being either a String or Currency value respectively:
in integer dict_id; {Dictionary ID}
in string report_name; {Report Name}
in string sNumber; {control field 1}
in integer sType; {control field 2}
in currency cSequenceOne; {control field 3}
in currency cSequenceTwo; {control field 4}
in integer iControl; {which piece of data to get}
The four control fields are designed to match the 4 key fields on the SOP_LINE_WORK (Sales Transaction Amounts Work) table; SOP Number, SOP Type, Line Item Sequence, Component Sequence.
However, the developer (who shall renamed nameless, he knows who he is and it is not me
) who originally created the functions made a mistake with the data types of the last two fields. The Line Item Sequence and Component Sequence fields are actually Long Integers and the functions are expecting Currency datatype.
If you attempt to pass the fields directly from the table, the Report Writer will generate an error when the report prints. So you will need to create a couple of calculated fields to change the datatype to currency and use them instead.
See the images below for settings to use for the calculated fields:
On the plus side, the currency datatype provides more flexibility to be used to pass any numeric data if you want to use the parameters in different ways.
See the next article which will use this technique.
Hope this helps.
David
KB Article: kb_mbs888884_usefulfunctionsforreports
This article was originally posted on http://www.winthropdc.com/blog.
Filed under: Development, Dexterity, Dynamics, GP, Microsoft, Report Writer Tagged: Development, Dexterity, Report Writer
This was originally posted here.

Like
Report

*This post is locked for comments