Written by Joe Cocuzzo, Senior VP of Report Writing Services - iatricSystems
Teach a man to fish… One of my staff needed to create a custom lookup in a MEDITECH NPR report to show the "mapped from" and "mapped to" values for a particular BAR.CLAIM map, and he asked me, “Have you ever done that?”
The dictionary looks like this:
This is one of those situations where, although I had never “done that," I knew exactly how to quickly figure out how to do it, and I decided it would make a nice NPR Report Writing blog post topic. This post is applicable to MEDITECH MAGIC and Client Server environments.
Custom ID Program
The first thing you should know is that you can create your own custom ID program and attach it to a computed field with an ID= attribute, using the "Edit Elements" option from Process Reports (either platform). In the screen shots in this blog post, I will use the Classic 3.x MEDITECH Workstation, so you will know by the blue/white/yellow color scheme vs. grey/black scheme, to which platform the screen shots relate.
MEDITECH has generic dictionary ID programs that will do a lookup for you if you have a dictionary that is built like this:
/GLOBAL[mnemonic]|0 = Active flag (Y or N)
/GLOBAL[mnemonic]|1 = Name
/GLOBAL[mnemonic]|n other pieces as needed
You can see the arguments for the programs by doing a lookup in a Macro and checking the top of the program for comments.
In MAGIC, in EE Macro you press the "GET" (F4) key then type \name of the program at the Get: prompt. A lookup on program names (but not macro names) is available:
Then you get a VIEW window into the source code of the program. You can cut and paste (F1 to mark left hand point, F2 to mark right hand point) to copy the comments into your macro for ease of reference:
In Client Server, keeping with the MEDITECH design rule that everything in Client Server needs to be close to but not the same as MAGIC, the "GET" key is F5 (not F4) and you get a prompt for the DPM, then for the procedure (and if you use a leading M, macro name lookup is available).
So, if we press F5, we get a "Get from File" window and a "DPM:" prompt:
Then, we get a procedure prompt:
Then, we get the same VIEW ONLY window into the source code of the Client Server procedure:
Based on the argument information for Z.id.dict.color (MAGIC) or Z.id (C/S), it is possible to write your own ID program that builds a custom dictionary or refers to a standard dictionary global. But, I usually take a short cut, which is to include a select field on the report (which can later be deleted) so I can let the report translator build me some sample Z.id.dict.color or Z.id code that I can cut and paste. I find that faster and easier than just programming based on the argument documentation.
My approach is to add a selection of a dictionary mnemonic to the report, then look at the object code of the report and use that code as the model for my custom ID program.
For MAGIC, you do it like this:
Add a selection for BAR.CLAIM.MAP.mnemonic to Page 2:
After translation of the screen, use a report that calls %Z.fec(0) in an AL START macro to get to the "Front End".
In the "Front End", you can use the "E" command to look at report object code:
If you press return at the end of the partial report name, you get a lookup:
The ".S" programs are the set of programs that produce the report selection screen. For this example, "BAR.PAT.zcus.is.id.demo.S" is the program that has the Z.id.dict.color code.
If that program is selected from the lookup, we will be in an object code editor provided by the "Front End" and can find the call to Z.id.dict.color and copy the code to the clipboard:
We just need the program call piece, so we break that code off and copy to the clipboard:
We can then program our own custom ID program as follows:
The arguments we see in the sample code taken from the screen are changed as follows:
|Argument||Original Code||Changed to|
|B||A||A (not changed)|
|C||"Mnemonic:12:_(Name:30L)||"Map From":12L_("Mapped To":30L)|
|E||"BR" (B = active and inactive, R reject new||"AR" A= Active R = reject new entries|
|F||"Claim Form Map"||"Claim Form Mappings"|
The basic idea is that the global changes from &BEC to our temp structure /DICT and the headings change to be more appropriate for the custom lookup we are building.
In Client Server, getting to the "Front End" to look at object code is too difficult due to MEDITECH security restrictions, so to look at and copy the object code from Z.id, we can use the "list object code" routine from Process Reports instead, as this allows us to view and copy from the screen programs made by the translator:
The conversion is almost the same for Client Server. Substitute /DICT for the &(B)BEM global and modify the headers:
Here is the MAGIC lookup:
Here is the Client Server version:
If you need more help…
Our Report Writing team can help you fix reports, create new ones, make old ones faster, and much more. Simply reach out to your Iatric Systems Account Executive or our NPR report writing team at email@example.com to discuss how we can help support your team!