There's a new display program in town.

There are many situations where being able to display a window of information is useful. There are many ways to do this from something as simple as @W.return("Here is a message.") to something as complex as calling an npr report and forcing it to output to the screen. I ran across a new display program when we received our 5.5 update - PHA.U.msg.with.text. I would prefer to have a Z program version, but it can still be made to work from a CDS in any application as long as the user has at least * access to a PHA database.


The program allows for a customizable title, choice of icon, multi-line header section, and built in scrolling for as many lines of text as you want.


Here are the arguments that the program uses.

  1. Window Title
  2. Header Text
  3. Message Text
  4. Icon to display
  5. Button Label
  6. Optional size controls (min scroll height, min scroll width, min window height, min window width)
  7. Optional window colors (window background, text box)

Window Title


This is simply the text that displays at the top of the window. In NUI this is also used in the window titlebar.

Header Text

The header text is stored in a single subscript slash variable. The example below uses /HDRTXT[Q].

Message Text

The message text is stored in a single subscript slash variable. The example below uses /MSGTEXT[Q]. If there is more text than can fit in the the window there are built in scroll controls so the remaining text can be seen.

Icon to display

This is the icon that displays with the header text. There are five choices - 

0 or nil - no icon
1 - error icon - red X
2 - question icon - question mark
3 - warning icon - exclamation mark
4 - information icon - i

Button Label

The is the text that displays on the button. The default is "Continue".

Window Size Controls

This is a packed piece {a,b,c,d} containing the minimum scroll height, the minimum scroll width, the minimum window height, and the minimum window width.

Window Color Controls

This is a packed piece {a,b} containing the window background color and the text background color.


The attribute simply calls the macro if the response to the query is Y. The argument /["aa"] is passing the patient urn to the macro. What value or values you pass as arguments will depend on what you want the macro to do. You could create a macro lots of possible messages and use the argument to let the macro know which message to display.

The Query Attribute

FCL1=IF{@.response="Y" %MIS.USER.zcus.tjt.pgm.M.pha.msg.text(/["aa"])}

The macro can be written wherever you want. I wrote it in MIS so it could be used by any application.

The macro sets up the various variables that will are needed by the PHA program, switches to the PHA application and displays the window. When the user clicks on the Continue button the window closes, the macro returns to the original application and passes control back to the CDS,

The Macro

; -- set up window title
"This is the window title"^TITLE,
; -- set up the header text - multiple lines allowed but not required
"This is line one of the message header"^/MSGHDR[1],
"This is line two of the message header"^/MSGHDR[2],
; -- set up the message text - multiple lines allowed
; -- the text is hardcoded in this example, but you could
; -- get the text however you want - a report fragment, etc
"This is the message text line 1"^/MSGTXT[1],
"This is the message text line 2"^/MSGTXT[2],
"This is the message text line 3"^/MSGTXT[3],
"This is the message text line 4"^/MSGTXT[4],
"This is the message text line 5"^/MSGTXT[5],
; set up some variables and switch to PHA application
; setting /.PHA.DONT.ASK.SITE will suppress the
; site prompt that the user would get when switching
; to PHA. Setting /.FAC to suppress the facility prompt
; is not necessary if original application such as LAB or ADM
; or EDM has already prompted the user for a facility
".PHA.DONT.ASK.SITE"^PHA,
".FAC"^FAC,
/.FAC^SAVEFAC,
"."^/[FAC],
1^/[PHA],
IF{%Z.switch.appl("PHA") ("Unable to access program. Contact IS.")^/.WO,
%Z.w.macro(1,1);
; -- call msg display program
%PHA.U.msg.with.text(TITLE,^/MSGHDR,^/MSGTXT,4,"","","")X,
; -- return to original application
%Z.switch.appl("")},
; -- reset facility
SAVEFAC^/[FAC],
; -- end of macro - must end with a semi-colon since it will be
; -- called from the attribute as a program
END;

The macro used to create the example window is not identical to the one listed above, so the window title, header text, and message text do not match what is in the macro. You should still be able to match up the sections.

Screen Shot Of Message Window

example message window



This is an example of one way we are actually using this. The macro is very complex, looping thru EDM assessments and treatments, counting query responses, various OE orders, etc, and determining the EDM level charge based on how many points it finds. The window displays all the various things that went into determining the points. This version also returns the point total which is then used as the response to another query.

EDM Point List Window

EDm points window


Other Magic Pages



Don't see what you need?  Visit one of these other sites


or email me your request (tomt at thomast357.com).