Written by Joe Cocuzzo, Senior VP of Report Writing Services - iatricSystems
This month we will show you how to have a location lookup on any report that shows only “I”npatient or “O”utpatient or “D”epartment type locations.
First some geeky background (feel free to just skip to the end to see the report names in our library and go get the code you will need).
In ADM, you can use the field inpatient.location to have a lookup that just shows the inpatient locations. At one Client/Server (actually 6.0) site, it looks like this:
But a lookup on @location is an inconvenient 5 screens worth of data, and in NUR, PHA, OE, RAD, ITS and so on, you would not have the handy @ADM.PAT.inpatient.location field at your disposal.
The EDIT ELEMENTS option on process reports will let you create your own ID program and attach it to an ID= attribute, so if only we knew the code for an ID restricted to I or D or O type locations, we would be all set.
The easy way to get at the code required is to write a quick report and look at the screen object code. Just write an ADM.PAT report with a select field of @inpatient.location.
In Client/Server (C/S) from the List Object Code routine, we want to pick this screen program:
In the object code, we can see a call to Z.id.dict.ck.fac. If we print to a file, we can open it in Notepad and copy the code:
In MAGIC, we can only see the object code of a screen program in the “Front End,” using the “E” command you can get a lookup of programs:
In the MAGIC screen, we see very similar code, which we can even copy into the Windows clipboard. (I have broken the line at a comma to make it shorter for readability here.)
Now we can create a simple PHA report where we want to have a location selection with an “inpatient only” lookup.
We just add a location field to the selections:
Next we write a macro as a program attached to our report. For C/S we can paste in the object code we got from listing the screen and change the reference to the program so it is in source code format; otherwise you get a translation error.
(Line broken for readability, and it is legal to break a line of code at a comma within arguments to a program.)
In MAGIC, we can just paste in the screen object code:
You can change the “I” to “O” or “D” for Outpatient or Department locations.
Now, for both platforms, use the EDIT ELEMENTS routine to attach your ID program as follows:
If you do not want to write the macro in the local report, if you load the Z report example I have provided, you could use a call like this instead. A report or report macro written in the Z or any MIS DPM is available to all reports in any application.
Now we have a nice lookup in PHA that shows us inpatient locations only, even though the field ADM.PAT.inpatient.location cannot be used on the select screen in PHA (it crashes).
This gives you a way to have an “I” patient, “O”utpatient, or “D”epartmental restricted lookup in an NPR report in any module. The code from the PHA report macros will work in any NPR report, although you should copy it to an MIS.USER, Z, or the individual report as you cannot call a PHA report from other application reports.
I have created 2 example reports for both MAGIC and C/S and placed them in our report library. For those who just skip to the bottom, here is what you can use:
Z.zcus.is.location.id holds a macro Z.zcus.is.location.id.M.id, which could be used in any report. PHA.RX.zcus.is.location.id is an example report from PHA where the ID program is PHA.RX.zcus.is.location.id.M.id.