Written by Joe Cocuzzo, Senior VP of Report Writing Services - iatricSystems
If you have a report that users are going to run and wait for, it can be nice to print some kind of progress message to the screen to keep them entertained.
The easiest way to do this is to use the @W.display macro, which will show a message in a window while the report runs.
Don’t use @W.display when the user (in MAGIC) sends report output to "S." (Your call will pop a small window and the report output will end up in that little box.)
Your attempt to display a progress message (in MAGIC) will not do anything when the user prints to VIEW. This is because output to VIEW occurs in the background and the screen is not available to your report for messages.
You can decide to send a message per each detail record, or at some less frequent point. If there are relatively few detail records, you might want to show a progress message per each detail record. If there could be a lot of detail records, you should show the progress message at some sort of break.
Our demonstration report is set up as a DOWNLOAD format, so we have Chars/Line at 200 and Lines/Page = Page Size. The progress message technique could be used in a report designed for printed output as well. Because even a few days of output will have many records, we are going to show a progress message per each day of the range, and those records are output.
Because we selected the bar.acct.discharge.date.index (in C/S it is called: "discharge.x") the sorts are automatically set up as follows:
Given that this is a download, we do not want a header line to print, so we suppress that region with an LC attribute:
Here are the footnotes on the example report. The highlighted one calls the macro to display the progress note. The other footnotes change the output into a tab delimited download file.
The hk1 macro uses the @W.display translator macro to show a message per each date as the sort changes:
Notice that we do not use an @ sign in front of the field bar.dis.ser. That is because we want to use the temporary sort value from the local variable and not have the report try to find the field for particular record. In the HK1 region, the subscript of the detail segment will be nil and @bar.dis.ser will fail to return anything, but bar.dis.ser will.
Using the @ sign on @bar.dis.ser will translate to:
Omitting the @ sign gives us:
If we look at the object code of the ".R" part of the report, we can see that the report loops on the local variable bzds (which is what bar.dis.ser translates to), so we will have a date in this local variable in the HK1 macro
So, when we run the report to a printer or a download, we will see a progress message as follows:
The message update per each day of the selected run date range, then you see the usual message about Downloading… or Printing…
Visit our report library at http://www.iatric.com/Information/NPRReportLibrarySearch.aspx.
You can find additional Report Writing Tips on our website at http://www.iatric.com/Information/NPRTips.aspx, as well as information about our on-site Report Writer Training and Report Writing Services.
To subscribe for email notifications for new Report Writing classes, please follow this link:
For more information, please contact our NPR report writing team at firstname.lastname@example.org.