Blogs Home
Wednesday, July 17, 2013 5:38 PM

Force Client/Server or MAGIC Report to Download File

Written by Joe Cocuzzo, Senior VP of Report Writing Services - iatricSystems

At our recent "rebroadcast" of the 2013 MUSE RD/NPR "Tips and Tricks" session, participants were particularly interested in how to force either a Client/Server or MAGIC NPR report direct to a download file, where the user does not see any Print On: prompt, and the report itself defines the path and file name for the output. In the "Tricks" session, I showed the C/S approach, but not the MAGIC one, so I have included both methods in this tip for our newsletter.

In C/S, you can use the "EDIT ELEMENTS" routine to add an IFE attribute and put a path into The user will not be prompted for an output destination and the report will automatically download to the path you load with your attribute code.

The Edit Elements routine allows you to attach field attributes to report selection fields in a similar fashion to the way you write attributes for Customer Defined Screens. We can exploit an IFE attribute (used to control whether the cursor stops at a field) to put the path into as the selection screen is displayed.

NPR Image 1

Here is what the IFE attribute should look like; substitute the local path and file name you wish to use for my example path and file here:

NPR Image 2

In MAGIC, you can imbed a program call in the title of the report, and use the program to set up an "auto download."

NPR Image 3

Since the title of the report is executed as a line of programming code when the selection screen is displayed (and again as the report banner is built for each page), we can use some quotes and underscores to imbed a program call in the title. We use a macro built as a program to set the report up to download, and we return the desired title as the last line of the program.

NPR Image 4

Since the MAGIC program involves quite a bit more code, I have uploaded this demonstration report to our MAGIC report library: