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

INHUTC4.m

Go to the documentation of this file.
  1. INHUTC4 ;KN,bar; 15 Sep 97 14:41; Interface Message/Error Search
  1. ;;3.01;BHL IHS Interfaces with GIS;;JUL 01, 2001
  1. ;COPYRIGHT 1991-2000 SAIC
  1. ;;COPYRIGHT 1997 SAIC
  1. ;
  1. ;
  1. ; MODULE NAME: Interface Message/Error Search (INHUTC4)
  1. ;
  1. ; PURPOSE:
  1. ; The purpose of the Interface Message/Error Search module is to
  1. ; provide User/Programmer a generic search functionality into files
  1. ; ^INTHU and ^INTHER.
  1. ;
  1. ; DESCRIPTION:
  1. ; This module contains three sub-modules: INHUTC4, INHUTC5 and INHUTC6.
  1. ;
  1. DISPLAY(INOPT,INMSGFND) ; Interactive output using DWL
  1. ;
  1. ; Description: The function Interactive search DISPLAY is performed
  1. ; the search interactively in the increment of matching
  1. ; records. Also, the DISPLAY uses List Processor DWL
  1. ; to present user with a list of matching records for
  1. ; selection and expanding or printing.
  1. ; Furthermore, this function has capability to allow for
  1. ; programmer to override the List Processor by assigning
  1. ; value to the option array INOPT. The search criteria
  1. ; is defined in INSRCH array and found records will be
  1. ; returned in INMSGFND array.
  1. ;
  1. ; Return:
  1. ; 0 = No error found (the program completed properly)
  1. ; 1 = No message to search (no message found)
  1. ; 2 = User stop the search (user abort DWL)
  1. ;
  1. ; Parameters:
  1. ; INOPT = Array of option values passed by reference.
  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 or ^INTHER.
  1. ;
  1. ; Code begins:
  1. N X,Y,INL,INQUIT,IND,INMSGSZ,INNODE,INSRCHCT,INTYPE,INST,INRET,INSRCH
  1. N DWL,DWLB,DWLMK,DWLMK1,DWLHOT,DWLR,DWLRF,XGABESCF,XBABPOP
  1. ;
  1. ; ---------- Retrieve Search criteria --------
  1. I '$D(INSRCH) S INX=$$GATHER^INHUTC6($G(INOPT("CRITERIA")),.INSRCH) Q:'INX 1
  1. S INTYPE=INSRCH("TYPE"),INST=$$UPCASE^%ZTF($E(INTYPE))_$$DNCASE^%ZTF($E(INTYPE,2,$L(INTYPE))),INMSGSZ=0,INRET=0
  1. ;
  1. I '$$SC^INHUTIL1 D G IHSJUMP
  1. .S DWLRF="INL"
  1. .D EN^INHUTC52(.INSRCH)
  1. .;VA List processor expands/displays within itself, so set quit
  1. .S:'$D(INOPT("LIST","HOT")) INRET=2
  1. ; ---------- Init ListMan Title --------------
  1. ; Set up the default DWL title - ;bar; set app and func?
  1. S:'$D(INOPT("LIST","TITLE")) X="Interface "_INST_" Search",X=$J("",IOM-$L(X)/2)_X,X=X_$J("",IOM-$L(X)),INOPT("LIST","TITLE")="W """_X_""""
  1. ;
  1. ; ---------- Transaction Specific ------------
  1. I INTYPE="TRANSACTION" D
  1. . ; determine scope of search and warn user if needed
  1. . S INMSGSZ=$$SRCHSIZE^INHMS4(.INSRCH) Q:INMSGSZ<0
  1. . ; Create the list processor help text
  1. . S:'$D(INOPT("LIST","HELP")) INOPT("LIST","HELP")="N INHELP D BLDHELP^INHMS3(.INHELP),SRCHHELP^INHMS3(.INHELP)"
  1. . S DWL("TITLE")=INOPT("LIST","TITLE")_" D INHTITLE^INHMS3(INMSGSZ,.INSRCH)"
  1. ;
  1. ; ---------- Error Specific ------------------
  1. I INTYPE="ERROR" D
  1. . ; determine scope of search and warn user if needed
  1. . S INMSGSZ=$$SRCHSIZE^INHERR4(.INSRCH,"^INTHER(""B"")")
  1. . S:'$D(INOPT("LIST","HELP")) INOPT("LIST","HELP")="N INHELP D BLDHELP^INHERR3(.INHELP),SRCHHELP^INHERR3(.INHELP)"
  1. . S DWL("TITLE")=INOPT("LIST","TITLE")_" D INHTITLE^INHERR3(INMSGSZ,.INSRCH)"
  1. ;
  1. ; ---------- Search Size ----------------------
  1. ; check for user abort or no records to search
  1. Q:INMSGSZ<0 2
  1. ;IHS branch
  1. I 'INMSGSZ,$$SC^INHUTIL1 D MS^DWD("No "_INST_"s to Search") S X=$$CR^UTSRD Q 1
  1. S INOPT("SRCHSIZE")=INMSGSZ
  1. ;
  1. ; ---------- Init ListMan Hot Keys ------------
  1. I $D(INOPT("LIST","HOT"))>9 D
  1. . S INNODE="" F S INNODE=$O(INOPT("LIST","HOT",INNODE)) Q:'INNODE S DWLHOT(INNODE)=INOPT("LIST","HOT",INNODE)
  1. . S DWL("TITLE")=DWL("TITLE")_" D HOTTITLE^INHOU2"
  1. ;
  1. ; ---------- DWL set up, save the display list in array DWLRF
  1. S DWL="GFEWZ",DWLRF="INL",DWLB="0^2^17^78"
  1. S:'$L($G(INOPT("LIST","HELP"))) DWL=DWL_"H"
  1. ; If expand in error search, then the display window is smaller for more titles
  1. I INTYPE="TRANSACTION",$G(INSRCH("INEXPAND")) S DWLB="0^3^16^78"
  1. I INTYPE="ERROR",$G(INSRCH("INEXPAND")) S DWLB="0^5^15^78"
  1. ;
  1. ; --------- set up "more" functionality --------
  1. S DWL("MORE")=$S($D(INOPT("LIST","MORE")):INOPT("LIST","MORE"),1:"FIND^INHUTC5(.INQUIT,.INOPT,.DWLRF,.INSRCH)")
  1. S INOPT("DISPFORMAT")=$G(INOPT("DISPFORMAT"),"D BLDSTR^INHUTC4(INM,INSRCH(""INFNDCT""),.INIEN,.INSRCH)")
  1. S INOPT("MAXFND")=$G(INOPT("MAXFND"),20),(INOPT("INSRCHCT"),INOPT("INFNDCT"))=0
  1. S INSRCHCT=0 D @DWL("MORE")
  1. I INQUIT=4 S INRET=2 G CLEAN
  1. I INQUIT=3,$G(INOPT("INFNDCT"))=0 S INRET=1 G CLEAN
  1. ;
  1. ; ---------- Set up default print template -----
  1. S:'$D(INOPT("PRINT")) INOPT("PRINT")="INH "_$S(INTYPE="TRANSACTION":"MESSAGE",1:INTYPE)_" DISPLAY"
  1. ;
  1. ; ---------- Call ListMan
  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^INHERR1(INOPT("PRINT"),INSRCH("FILENUM"))
  1. . ; Let user get help, and hot key if any
  1. . I DWLR="?" X INOPT("LIST","HELP")
  1. . I DWLR["H",$D(INOPT("LIST","HOT"))>9,($D(DWLMK)) N INHOTOPT S INHOTOPT="" F S INHOTOPT=$O(INOPT("LIST","HOT",INHOTOPT)) Q:'INHOTOPT D
  1. .. I DWLR[$P(INOPT("LIST","HOT",INHOTOPT),U,2) X INOPT("LIST","HOT",INHOTOPT,"ACTION")
  1. ; If user abort DWL, then set the return value, quit and clear screen
  1. I DWLR["^" S INRET=2 G CLEAN
  1. IHSJUMP ;IHS logic jumps here to bypass CHCS Listman calls
  1. I $D(INOPT("LIST","HOT"))>9,$D(DWLMK) N INHOTOPT S INHOTOPT=$O(INOPT("LIST","HOT","")) X INOPT("LIST","HOT",INHOTOPT,"ACTION")
  1. ; Action-Bar to be called if a name was passed and system is not IHS.
  1. I $L($G(INOPT("LIST","BAR"))),$$SC^INHUTIL1 D ABASK^XGABAR(INOPT("LIST","BAR")) S INOPT("LIST","BAR","XGABESCF")=XGABESCF,INOPT("LIST","BAR","XGABPOP")=XGABPOP
  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 functionality has been exercized.
  1. I $D(DWLMK) D
  1. . S:DWLRF[U INMSGFND="^UTILITY(""INS"","_$J_")" K @INMSGFND
  1. . S INNODE=0 F S INNODE=$O(DWLMK(INNODE)) Q:INNODE="" S @INMSGFND@(DWLMK(INNODE))=@DWLRF@(INNODE,0)
  1. CLEAN ; cleanup vars and the selection array
  1. K:$D(@DWLRF) @DWLRF
  1. M INOPT("INSRCH")=INSRCH
  1. D CLEAR^DW
  1. Q INRET
  1. ;
  1. BLDSTR(INDA,INSEQ,DWLRF,INSRCH) ; Build text to display in ListMan screen
  1. ;
  1. ; input: INDA = ien of record found
  1. ; INSEQ = list sequence number
  1. ; DWLRF = name of list storage array
  1. ; INSRCH = search criteria array
  1. ; return:
  1. ; Build entries of text into DWLRF array
  1. ;
  1. N INETBL,INMTBL
  1. I INSRCH("TYPE")="TRANSACTION" D
  1. . S @DWLRF@(INSEQ)=$$INMSGSTR^INHMS2(INDA,"","")
  1. . I $G(INSRCH("INEXPAND")) S %=$$INMSGSTR^INHMS2(INDA,"",$G(INSRCH("INEXPAND"))) I $L(%) S @DWLRF@(INSEQ+.1)=%
  1. I INSRCH("TYPE")="ERROR" D
  1. . M INETBL=INSRCH("INETBL"),INMTBL=INSRCH("INMTBL")
  1. . S @DWLRF@(INSEQ)=$$INMSGSTR^INHERR3(INDA,"",$G(INSRCH("INEXPAND")))
  1. . ; show the expanded listing date only if EXPAND and a MESSAGE exists
  1. . D:$G(INSRCH("INEXPAND"))
  1. .. S %=$$INMSGSTR^INHERR3(INDA,"",$G(INSRCH("INEXPAND")),2) S:$L(%) @DWLRF@((INSEQ+.1))=%
  1. .. S %=$$INMSGSTR^INHERR3(INDA,"",$G(INSRCH("INEXPAND")),3) S:$L(%) @DWLRF@((INSEQ+.2))=%
  1. . S %=$$INMSGSTR^INHERR3(INDA,"",$G(INSRCH("INEXPAND")),1) S:$L(%) @DWLRF@((INSEQ+.3))=%
  1. ; make first line selectable, INDA is used to pass the ien to the selected array later
  1. S @DWLRF@(INSEQ,0)=INDA
  1. Q
  1. ;