Finding out how to call an existing Report
Over the years, I have been asked many times how to call a Report Writer report to make it behave the same as if it was called by the original code.
If you are member of the Source Code program, you could always find the run report command in the source script and that would provide the information about the Restrictions or Legends passed. However, this information can be obtained without needing access to the source code.
The Dexterity Report Writer has a debugging feature which we can leverage to obtain the information we need. There are two methods of activating the DebugRW functionality:
- Use the Support Debugging Tool, Tools >> Support Debugging Tool >> Options >> Dex.ini Settings >> Reports. Mark the "Logs the run report statement as the Report Writer sees it" checkbox.
- Manually add DebugRW=2 setting to the DEX.INI file.
Once active, every time the Report Writer runs a report it will append to the DebugRW.txt file the details of how the report was called.
Below is the information logged for when the 'RM Customer Report' was printed from the Customer Maintenance window for customer "Aaron Fitz Electrical":
run report 'RM Customer Report' (256)
legends " Current",
" 31 - 60 Days",
" 61 - 90 Days",
" 91 - 120 Days",
"AARONFIT0001 - AARONFIT0001",
"Aaron Fitz Electrical - Aaron Fitz Electrical",
"USA-ILMO-T1 - USA-ILMO-T1",
"Retail - Retail",
"PAUL W. - PAUL W.",
"TERRITORY 1 - TERRITORY 1",
"Aaron Fitz Elec - Aaron Fitz Elec",
"98052-6399 - 98052-6399",
"WA - WA",
"42555501010000 - 42555501010000",
"Bob Fitz - Bob Fitz",
"by Debtor ID",
( RM_Customer_MSTR(141).Customer Number(493) = "\012AARONFIT0001 " ) report queued with result = 1
NOTE: The Resource ID information in brackets for the report, table and fields. You can use the Resource Information window in the Support Debugging Tool to cross reference resources by their ID. This is sometimes useful when the name of the resource is not shown correctly and displays '[Not Found]'.
The Restriction is shown in the Table.Field format and will need to be converted to the Field of table Table format for the actual Dexterity call. The Legends will probably need a little analysis to identify what information is being passed to the report. You might need to change options and print the report again to see what changes the options can make to the legends. Once you have the legends identified you can then place the values into the string fields to pass to the report.
Based on the information captured, you will be able to generate a run report command similar to one below:
Example Report Writer Call
run report 'RM Customer Report' with restriction
'Customer Number' of file RM_Customer_MSTR = 'Customer Number'
l_legend1, l_legend2, l_legend3, l_legend4,l_legend5,
l_legend6, l_legend7, l_legend8, l_legend9, l_legend10,
l_legend11, l_legend12, l_legend13, l_legend14, l_legend15,
l_legend16, l_legend17, l_legend18, l_legend19;
As you can see this technique can be used to help a developer understand how they can call existing reports.