Well, that's no ordinary rabbit!

Pulling NUR Canned Text into a Multiple Query

Note: the attribute and macro were changed 7/19/06 to remove usage of /S.LAST.QUERY. Changes are in red.

This page describes how to pull nursing canned text into a multiple type query on an NUR cds. The code uses the MIS.EDIT.sh program. When the cursor reaches the query an IFE attribute calls the program. The query response area then becomes a box within the MIS.EDIT.sh program. The way the program is called allows for the F4 (get) key to be funtional. After pressing F4 the cursor changes from a block to an underline. At this point you can type the canned text mnemonic or press F9 for a lookup of available canned texts. After the canned text selection is made another window opens. While this window is open the <ENTER> key takes the user thru the tab stops. After the user has gone thru all the tab stops the window closes and the text is brought back into the query. At this point the user is still in the MIS.EDIT.sh program and must press <esc> to return to the CDS. After using it a couple times the users should be familiar with how it works, but it might be confusing for a while. Adding a label query on the screen reminding them to press <esc> might be helpful.

There are a couple of quirks involved. The program changes the query response area to blue. After <esc> is pressed to return to the CDS the color will change back to light green as you scroll up or down thru the text.

The code is very similar to the code for word-wrapping in a multiple type query devised by guru Joe C - you pass in R and S as a couple of arguments and everything else is automatic.

Important Note: canned text can be up to 80 characters wide in NUR but the maximum length for a query response is 75 characters. I did not put anything into the code to check for lines greater than the query response length. Pulling in canned text which excedes the response length will corrupt the screen and may crash the routine.

Query Attribute

The IFE attribute calls the program if there are not any previous responses. Once a response is entered the user can edit the response but will no longer have the ability to pull in canned text.


Note: attribute changed to remove usage of /S.LAST.QUERY. Replace MYQUERY on both lines with the actual name of your query. Changes are in red.

IFE=IF{/[ANS%0,"MYQUERY","M",1] 1;
IFE=%NUR.PAT.zcus.pgm.M.ct.gen(ANS,R,S,"","MYQUERY"),1}

The Macro

The macro should be written in NUR.PAT since it uses some NUR.PAT fields. I was not sure if they were necessary so I left them in just in case the canned text needs them in some way. The report I used is NUR.PAT.zcus.pgm and the macro is ct.gen. If you use a different report name and/or macro name you will need to adjust the IFE attribute accordingly. Copying from a web page does not always preserve all the spacing and line breaks so I have the report containing the macro available for download here. Be sure to file the macro after uploading the report.

Note: macro changed to remove usage of /S.LAST.QUERY. Change (line 6 of macro) is in red.

A%0^ANS,
B^ROW,
C^COL,
D^MAX,
IF{ANS 1,
E^MIS.QUERY.mnemonic,
/patient^patient,@NUR.PAT.sex^/NUR.PAT.sex,
IF{@MIS.QUERY.multiple'="Y" @W.err("Query "_MIS.QUERY.mnemonic_" is not a multiple");
@CLEANUP,
@LOAD.TEXT,
@SETUP.FOR.EDITOR,
@CALL.MIS.TEXT.EDITOR,
@SAVE.TEXT}},
END;

SETUP.FOR.EDITOR
; Canned text will be put in [ ] format
;
"Y"^/MIS.GET.EVAL,
^@MIS.DATA.DICT.main["NUR"]^/MIS.GET.FLD,
^@Root(@NUR.TEXT.main)^/MIS.GET.TXT

CALL.MIS.TEXT.EDITOR
; A - file structure
; B - top row offset
; C - bottom row
; D - width
; E - left margin
IF{@.gui 2;0}^OFF,
ROW+@MIS.QUERY.multiple.line-1+OFF^ROWS,
@MIS.QUERY.length^LEN,
; the next 2 lines of code need to be combined into 1 line
; but were split here to fit in the browser window
%MIS.EDIT.sh(^/CANT,ROW+OFF,ROWS,LEN-2,COL,"Q",
"NUR.DOC","note.edit",{"MIS.EDIT.text.ed.get",@KEY.OVERRIDES},J,K,"")X^END
; combine previous 2 lines into one line using the F6 key

KEY.OVERRIDES
; 132 = Get Key (F4)
; 164 = Help Key (Shift F8)
D(132,164)

CLEANUP
""^XX,
DO{+/CANT[XX]^XX ""^/CANT[XX]}

LOAD.TEXT
""^XX,
DO{+/[ANS,MIS.QUERY.mnemonic,"M",XX]^XX /[ANS,MIS.QUERY.mnemonic,"M",XX]|0^/CANT[XX]}

SAVE.TEXT
""^XX,
DO{+/[ANS,MIS.QUERY.mnemonic,"M",XX]^XX ""^/[ANS,MIS.QUERY.mnemonic,"M",XX]},
""^XX,
DO{+/CANT[XX]^XX /CANT[XX]^/[ANS,MIS.QUERY.mnemonic,"M",XX]|0,
IF{XX'>@MIS.QUERY.multiple.line P(ROW+XX-1,COL,/CANT[XX]:(LEN_"L"))^#},
""^/CANT[XX]}

Comments


Screen Shots

When the cursor reaches the multiple query the response area changes to blue.


canned text image 1

After pressing F4 (get) the user can enter the canned text mnemonic or press F9 for a lookup.


canned text image 2

After selecting the canned text this window opens if there are any tab stops in the canned text. 


canned text image 3

After all the tab stops have been processed the user is returned to the CDS blue response box. 


canned text image 5

Press <esc> at that point to actually return to the CDS and maybe even get the response box to change back to green. A second <esc> should clean up any corruption and restore the correct colors.


canned text image 4

Other Magic Pages



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


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