Home   Package List   Routine Alphabetical List   Global Alphabetical List   FileMan Files List   FileMan Sub-Files List   Package Component Lists   Package-Namespace Mapping  
Routine: INHMS

INHMS.m

Go to the documentation of this file.
  1. INHMS ;JSH,DJL; 17 Jan 96 10:03;Interface - Message Search
  1. ;;3.01;BHL IHS Interfaces with GIS;;JUL 01, 2001
  1. ;COPYRIGHT 1991-2000 SAIC
  1. ;
  1. ; MODULE NAME: SEARCH ( Interface Message Search Routine )
  1. ; DESCRIPTION: Prompts the user for search criteria to be used
  1. ; to find matches in the Interface Message Queue
  1. ; file (^INTHU). The user is presented with a list
  1. ; of matching items which can be selectively expanded
  1. ; or printed(user chosen device). The user is then
  1. ; brought back to the Search Criteria menu and can
  1. ; continue with another search or exit with the F10 key.
  1. ; RETURN = none
  1. ; PARAMETERS = none
  1. ; CODE BEGINS
  1. N INDA,INQUIT,INFNDNAM,INSELECT,INPARM2
  1. S INFNDNAM="INMSGS" N @INFNDNAM
  1. ; Create the list processor help text
  1. S INPARM2("INHELP")="N INHELP D BLDHELP^INHMS3(.INHELP),SRCHHELP^INHMS3(.INHELP)"
  1. ; Create the list processor TITLE text
  1. S INPARM2("TITLE")="W ?IOM-$L(""Interface Message Search"")/2,""Interface Message Search"""
  1. F S INFNDNAM="INMSGS" S INQUIT=$$BGNSRCH(.INFNDNAM,1,.INDA,.INPARM2) Q:$S(INQUIT=0:0,INQUIT=4:0,1:1) D:$O(@INFNDNAM@(0)) POST^INHMS2(INFNDNAM) K @INFNDNAM
  1. D:+INDA INKINDA(INDA)
  1. Q
  1. ;
  1. BGNSRCH(INMSGFND,INKINDA,INDA,INPARM2) ; Begin a search
  1. ; MODULE NAME: BGNSRCH ( Programmers entry point )
  1. ; DESCRIPTION: Same fuctionality as SEARCH^INHMS but only executes
  1. ; a single pass. This would be useful for a programmers
  1. ; interface because an array is loaded with the selected
  1. ; items and could be used for other processing needs. An
  1. ; Action-Bar can be added to the process by setting the
  1. ; fourth parameter to the name of the Action-Bar.
  1. ; RETURN = 0 = "CONTINUE" The program completed properly
  1. ; 1 = "EXIT" The user exited ^DWC
  1. ; 2 = "SYSTEM" The incorrect system
  1. ; 3 = "CREATION" The entry to store the search criteria could
  1. ; not be created
  1. ; 4 = "CRITERIA" The required search criteria was not entered
  1. ; PARAMETERS:
  1. ; INMSGFND = A NAME of an array in which to build a list(in
  1. ; subscript/selection order) of the selected items IEN's
  1. ; into ^INTHU
  1. ; INKINDA = Flag used to initiate the call to INKINDA(INDA) to do
  1. ; cleanup of the ^DIZ global if set to 0 after the search
  1. ; or let the calling routine call INKINDA(INDA).
  1. ; INDA = Set to the node into ^DIZ(4001.1) where the selected
  1. ; search criteria is setup.
  1. ; INPARM2 = Structure nodes as follows:
  1. ; "HELP" = Executable M code used for the List Processor HELP
  1. ; "TITLE" = Executable M code use for the List Processor Title
  1. ; "BAR" = A NAME of an Action-Bar to be called immediately after
  1. ; all the items in the list have been selected. The
  1. ; structure passed is to be updated with the XGABESCF and
  1. ; XGABPOP nodes upon exiting. The calling routine must
  1. ; evaluate the appropriate structure nodes to determine
  1. ; the action to be taken
  1. ; "BAR","XGABESCF" & "BAR","XGABPOP" set after bar is run
  1. ; "HOT",x ="string indicating the function of the key^ret. value"
  1. ; "HOT",x,"ACTION" ="Executable M code used on key selection)"
  1. ; CODE BEGINS
  1. N X,Y,INTEMP,DWLR,DWLRF,INL,INQUIT,INUQUIT,IND,INNODE,INSRCH,INM,INSRCHCT,INRVSRCH
  1. N DIC,DWL,DWLB,DIE,DWN,INERRTYP,DWLMK,DWLMK1,DWLMK2,DWLMSG,DWLHOT,DIPA,INMSGSZ,XGABESCF,XBABPOP
  1. S INKINDA=$G(INKINDA),INDA=$G(INDA)
  1. S INERRTYP("CONTINUE")=0,INERRTYP("EXIT")=1,INERRTYP("SYSTEM")=2,INERRTYP("CREATION")=3,INERRTYP("CRITERIA")=4
  1. I '$$SC^INHUTIL1 D ERR^INHMS2("Incorrect system type! This routine option is not available on this system.") Q INERRTYP("SYSTEM")
  1. ; create ^DIZ file if 1) single pass calling
  1. ; 2) multi-pass and INDA is not yet created
  1. I 'INDA S X=$J_"_"_DUZ_"_"_$P($H,",",2),DIC=4001.1,DIC(0)="L",DLAYGO=4001.1 D ^DIC S INDA=+Y I +Y<0 D ERR^INHMS2("Unable to create file "_X_" Interface Message Search Failed") Q INERRTYP("CREATION")
  1. S DA=INDA
  1. ; set the listing order default=Newest to Oldest
  1. S:'$D(^DIZ(4001.1,INDA,11)) ^DIZ(4001.1,INDA,11)=0
  1. ; set the expanded display default=NO
  1. S:'$D(^DIZ(4001.1,INDA,12)) ^DIZ(4001.1,INDA,12)=0
  1. ; Force ^DWC to ask to file then Preset the fields for another search
  1. S DWASK=""
  1. S DIE=4001.1,DWN="INH MESSAGE SEARCH" D ^DWC
  1. I '$D(DWFILE) S INUQUIT=1 D:'INKINDA INKINDA(INDA) Q INERRTYP("EXIT")
  1. I '$G(^DIZ(4001.1,INDA,1)) D ERR^INHMS2("START DATE search criteria was not entered.","",1) D:'INKINDA INKINDA(INDA) Q INERRTYP("CRITERIA")
  1. D GATHER^INHMS4(.INSRCH,INDA,.IND,.INRVSRCH)
  1. S INMSGSZ=$$SRCHSIZE^INHMS4(.INSRCH) Q:INMSGSZ<0 INERRTYP("CONTINUE") I 'INMSGSZ D MS^DWD("No Messages to Search") S X=$$CR^UTSRD D:'INKINDA INKINDA(INDA) Q INERRTYP("CONTINUE")
  1. ; Setup the Hot-Key paramters to be called if set in INPARM2 structure.
  1. I $D(INPARM2("HOT"))>9 S INNODE="" F S INNODE=$O(INPARM2("HOT",INNODE)) Q:'INNODE S DWLHOT(INNODE)=INPARM2("HOT",INNODE)
  1. I $D(INPARM2("HOT"))>9 S INPARM2("TITLE")=$G(INPARM2("TITLE"))_" D HOTTITLE^INHOU2"
  1. ; setup the title used in the list processor
  1. S:$G(DWL("TITLE"))'["INHTITLE^INHMS3" DWL("TITLE")=$G(INPARM2("TITLE"))_" D INHTITLE^INHMS3(INMSGSZ,.INSRCH)"
  1. S DWL="GFEW",DWLRF="INL",DWL("MORE")="LIST^INHMS2(.INQUIT,.IND,.INSRCH,.DWLRF,INRVSRCH,.INL,.INSRCHCT)",DWLB="0^2^17^78",$P(@DWLRF,U,2)=0
  1. S INSRCHCT=0 D LIST^INHMS2(.INQUIT,.IND,.INSRCH,.DWLRF,INRVSRCH,.INL,.INSRCHCT) I INQUIT D:'INKINDA INKINDA(INDA) K @DWLRF Q INERRTYP("CONTINUE")
  1. S:'$L($G(INPARM2("INHELP"))) DWL=DWL_"H"
  1. F D ^DWL Q:$$QUITDWL^INHMS3($G(DWLR)) S:DWL'["K" DWL=DWL_"K" D Q:$D(@DWLRF)<10
  1. . I DWLR="E" D EXPAND^INHMS1
  1. . I DWLR="?" X INPARM2("INHELP")
  1. . I DWLR["H",$D(INPARM2("HOT"))>9,($D(DWLMK)) N INHOTOPT S INHOTOPT="" F S INHOTOPT=$O(INPARM2("HOT",INHOTOPT)) Q:'INHOTOPT D
  1. .. I DWLR[$P(INPARM2("HOT",INHOTOPT),U,2) X INPARM2("HOT",INHOTOPT,"ACTION")
  1. I DWLR["^" K DWLMK,DWLMK1
  1. I $D(INPARM2("HOT"))>9,$D(DWLMK) N INHOTOPT S INHOTOPT=$O(INPARM2("HOT","")) X INPARM2("HOT",INHOTOPT,"ACTION")
  1. ; Action-Bar to be called if a name was passed.
  1. I $L($G(INPARM2("BAR"))) D ABASK^XGABAR(INPARM2("BAR")) S INPARM2("BAR","XGABESCF")=XGABESCF,INPARM2("BAR","XGABPOP")=XGABPOP
  1. ;
  1. ; build the selection-ordered list in @INMSGFND (^UTILITY if needed)
  1. ; build it from 'DWLMK' because 'DWLMK1' is not reliable after the
  1. ; EXPAND functality has been exercized.
  1. I $D(DWLMK) D
  1. . K @INMSGFND
  1. . I DWLRF[U S INMSGFND="^UTILITY(""INL"","_$J_"_"_DUZ_"_"_$P($H,",",2)_")" K @INMSGFND
  1. . S INNODE=0 F S INNODE=$O(DWLMK(INNODE)) Q:INNODE="" S @INMSGFND@(DWLMK(INNODE))=@DWLRF@(INNODE,0)
  1. D:'INKINDA INKINDA(INDA)
  1. ; cleanup the array built as list for ^DWL(could be in global(expand))
  1. K:$D(@DWLRF) @DWLRF Q INERRTYP("CONTINUE")
  1. ;
  1. INKINDA(INDA) ; Clean-up search criteria storage data
  1. ; MODULE NAME: INKINDA ( Search Criteria Clean-up Routine )
  1. ; DESCRIPTION: Cleans up the Search Criteria Data in the ^DIZ global
  1. ; by using the ^DIK routine.
  1. ; RETURN = none
  1. ; PARAMETERS:
  1. ; INDA = Unique IEN into ^DIZ used to store Search Criteria Data
  1. ; CODE BEGINS
  1. S INDA=$G(INDA)
  1. I $D(^DIZ(4001.1,+INDA)) N X,DA,DIK S DA=INDA,DIK="^DIZ(4001.1," D ^DIK
  1. Q
  1. ;