Blogs Home
Friday, January 23, 2015 11:45 AM

NPR Tip: Keep Users Entertained During Download or Printing (MAGIC or Client/Server)

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.

Some caveats:

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.

NPR image

Because we selected the (in C/S it is called: "discharge.x") the sorts are automatically set up as follows:

NPR image

Given that this is a download, we do not want a header line to print, so we suppress that region with an LC attribute:

NPR image

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.

NPR image

The hk1 macro uses the @W.display translator macro to show a message per each date as the sort changes:

NPR image

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:

NPR image

Omitting the @ sign gives us:

NPR image

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

NPR image

So, when we run the report to a printer or a download, we will see a progress message as follows:

NPR image

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

You can find additional Report Writing Tips on our website at, 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