Blogs Home
Thursday, May 22, 2014 12:50 PM

NPR Tip (MAGIC) – Default Segment and Directory in "MOVE REPORTS"

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

Last month we had a Client/Server only tip about a handy Page 1 of N utility. At MUSE our Tips and Tricks session will include an updated version of an approach that will do this for MAGIC NPR reports as well. For this May tip, I will show you how to solve the minor annoyance of having to guess about the NPR master segment and directory for the MOVE REPORTS routine.

Anyone who works at multiple hospitals, or who forgets the exact combinations of dots and numbers cooked up in the naming of the latest test directory, has experienced the fun of guessing for the NPR Master Segment and NPR Directory in the MOVE routine. If you are in an HCA site, you have the added fun of dealing with segments with long cryptic names, instead of the typical A..B..C - you might have 50 choices from TNNANVA to TNNANVZX.

This month, we will show you a report you can place on a Hot Key menu for NPR that you can use to quickly find out the name of the NPR master segment and directory you need to use for the MOVE routine.

The first problem is how to know about segments and directories you aren’t in. What if we take a look at MIS.signon and see how that program does it? After all, when you manage a device to that program, the user sees a list of both LIVE and TEST directories.

Just hit F4 while editing any macro of any report and look at the MEDITECH source code of MIS.signon, like so:

We see in this program that MIS.signon loops through NPR.MIS.DB.npr.mis.remote.index to show the user a list of "npr.mis.remote.title" fields to pick from.

Even though we cannot use the DPM NPR.MIS.DB on page 1 of a report, we can see its segments and fields in a macro with F9, and we can write code to loop through the entries and build an MV array for our report.

(Note to C/S report writers, the C/S field lookup program will not show you DPMs unless they are flagged Customer Report Writer access = Y. You can still use them in macros, but you have to figure out the names from listing MEDITECH reports or getting to the data definitions by other means.)

So, if we write a report in NPR.REP in the npr.rep.main segment and set up the selects to just print one record like this:

This is just a "trick" to force the report to select exactly one record by selecting the last report urn, regardless of what that is.

Then build an MV array in the picture:

Then write a macro "detail" to be called from an AL D footnote:

The macro does the same looping as MIS.signon, but show the user segment and directory rather than MIS title information:

Here is the report output. Notice the current segment/directory is flagged in the third MV column.

The report has been loaded to our MAGIC NPR report library. So you can just grab it "as is" and use it on your custom hot key menu attached to the NPR application.