Written by Joe Cocuzzo, Senior VP of Report Writing Services - iatricSystems
One practice which we highly recommend is to try to make reports generic and flexible and avoid having multiple copies with hardcoded selections or query values.
Rather than hardcode each manager's departments into a report (and create a version for each manager), use %MIS.GL.DEPT.user.okay(@ dept) to check financial access and use one report for all managers. For more details see our tip from April 2004.
Rather than type each prompt in the picture, and code each query mnemonic (and need to change the report every time the screen is changed), use MIS.SCREEN.print in your report. For more details see our tip from June 2008.
When you write a statistical report, it is common to create two versions, one which includes detail records to allow the user to verify your work (or to see detail records when desired) and another that is a summary only.
To do this you simply copy the detail version to another report and change the Detail prompt on Page 1 (a/k/a "General Tab") to N. I call this a "Nancy Reagan report" ("Just say No to detail").
The problem with this is that you now have two reports to maintain instead of one.
It is relatively easy to provide a combined detail/summary report by using the LC (line check) attribute to allow the user to run a single report in "detail" or "summary" mode.
First add a Y/N query to the selections with the IG (Ignore) operator to allow the user to indicate whether they would like to include detail records.
Next, add an LC to suppress the detail section of the report if the user says "N" to detail.
You can use LCR (Line check range) if you have more than one detail line in your report.
Any numeric regular field placed in a trailer (TR or TKn) region and any computed field with a statistical function defined (FNC=TOT, FNC=AVG etc), will work whether you elect to print detail or not. However, if you have a computed field in the detail region and in the trailer, if you suppress the detail with a line check, that field will no longer total.
The solution is to copy the detail computed field into another field, add a FNC=TOT attribute and place the copy in any trailer regions (TKn, TR) where it is needed.
This issue occurs only for computed (xx) fields, a standard numeric field like @ item.amount (in this BAR.BCH example) will total whether the detail is suppressed or not.