DICQ ;SFISC/XAK,TKW-HELP FOR LOOKUPS ;7:20 AM 17 May 2007
;;22.0;VA FileMan;**4,3,57,151**;Mar 30, 1999;Build 10
;Per VHA Directive 2004-038, this routine should not be modified.
S DZ=X D:DIC(0)]"" DQ
I '$D(DDS),$G(DDH) D ^DDSU
S:$D(DZ) X=DZ K DZ,DDH,DIZ,DDD I $D(DTOUT) S Y=-1 D Q^DIC2 Q
D A^DIC Q
;
DQ ; Main entry point for displaying online ^DIC help (list of current
; entries in a file.
N %,%Y,X,Y,DD,DDC,DDD,DS,DID01,DICNT,DIDONE,DIFROM,DIPART,DIW,DIX,DIY,DIZ,DIUPRITE,DST,DIBEGSUB,DIBEGIX
I $D(DZ)[0 N DZ S DZ=""
S DDC=$S($D(DDS):7,1:15)
N:'$D(DDH) DDH S DDH=+$G(DDH)
S DIBEGIX=D
I '($D(DIRECUR)#2) N DIRECUR S DIRECUR=0
I '$D(DO) N DO D GETFA^DIC1(.DIC,.DO)
I DO="0^-1" K DO S DST=" Pointed-to File does not exist!" D % Q
S DICNT=$P(DO,U,4),DIY=DO D DIY
S X=$S($D(^DD(+DO(2),.001,0)):$P(^(0),U,1),DIC(0)["N":"NUMBER",1:""),DIUPRITE=X]""
S DIW=^DD(+DO(2),.01,0),DIW=$P(DIW,U,2,3)
G:$D(^DD(+DO(2),0,"QUES")) @^("QUES")
I DIUPRITE S DS=.001 D DS
DQ1 I $G(DIFILEI),$G(DINDEX)]"" M DIX=DINDEX
E N DIFILEI,DIENS K % M %=DA N DA M DA=% K % D
. D GETFILE^DIC0(.DIC,.DIFILEI,.DIENS)
. S DIX=$G(D),DIX("WAY")=1 D INDEX^DICUIX(.DIFILEI,"hl",.DIX)
. Q
S DIBEGSUB=DIX("#")
I DIFILEI="" D % Q
I $D(DIC("?N",DIFILEI)) S DDC=DIC("?N",DIFILEI)
S DIFROM=""
N DISAVIX M DISAVIX=DIX
D IX K DISAVIX
I 'DICNT D 0 Q
S DIDONE=0 I DZ'="??" D I DIDONE D 0 Q
. D DSPFLD Q:DICNT<11
. N DIOUT S DIOUT=0 F D ASKCUR Q:DIOUT
. Q
D EN^DICQ1
Q
;
IX N DD,DIF,DIFIL,DIFLD,DIFORCE,DIEND,DITMP,I,P,F,X,%
S (DD,%)="",DID01=0,DIF="h"_$P("M^",U,DIC(0)["M")
S DIFORCE=$S($D(DID):1,1:0),DIFORCE(0)=$S($D(DID):DID,1:"*"),DIFORCE(1)=1
F D Q:DIX=""!(DIC(0)'["M")
. S DIEND=$S(DIX=DIBEGIX:DIX("#"),1:1)
. S (P,DS)="" F I=1:1:DIEND D
. . S DIFIL=$G(DIX(I,"FILE")),DIFLD=$G(DIX(I,"FIELD"))
. . I DIFIL,DIFLD Q:$D(DITMP(DIFIL,DIFLD)) S DITMP(DIFIL,DIFLD)=""
. . I DIX=DIBEGIX D
. . . I DIFIL=DIFILEI,DIFLD=.01,DIX("FLISTD")[("^"_.01_"^") S DID01=1
. . . S DS=.002 Q
. . E S X=DIFLD S:DIFILEI'=DIFIL X=DIFIL_" "_DIFLD S:DS]"" DS=DS_"^" S DS=DS_X
. . S X=$G(DIX(I,"PROMPT"))
. . I X="",$D(^DD(+DIFIL,+DIFLD,0))#2 S X=$P(^(0),U)
. . I I=1 S %=DIX(1,"TYPE")
. . Q:X="" I DIX("#")=1,X=$G(DS(.002)) Q
. . I $L(X)+$L(P)'>70 S P=P_$P(" & ^",U,P]"")_X Q
. . S:P'["..." P=P_"..." Q
. I P]"",DS]"" S X=P D DS
. I @("$D("_DIC_"DIX))>9!$D(DF)"),DD="" S DD=DIX,DIW=% S:'DICNT DICNT=2 S:'$D(^(DD)) DICNT=0,DIUPRITE=0
. I DIC(0)'["M" S DIX="" Q
. D NXTINDX^DICF2(.DIX,.DIFORCE,.DIFILEI,DIF,"","*") Q:DIX=""
. D INDEX^DICUIX(.DIFILEI,"hql",.DIX) Q
K DIX
I DIBEGIX=DD M DIX=DISAVIX
E S (DIBEGIX,DIX)=DD I DIX]"" S DIX("WAY")=1 D INDEX^DICUIX(.DIFILEI,"hl",.DIX)
I DD="" S DIUPRITE=1 I $O(^DD(DIFILEI,0,"IX","AZ"))]""!($O(^DD("IX","BB",DIFILEI,"AZ"))]"") S DICNT=0
S:DZ["BAD" DICNT=0
Q
;
DSPFLD ; Display list of lookup fields
N X S DST=$$EZBLD^DIALOG(8063,$P(DO,U)),DS=0
F X=1:1 S DS=$O(DS(DS)) Q:DS="" D
. S:X>1!$G(DS(0)) DST=DST_$$EZBLD^DIALOG(8067)
. D:$L(DST)+$L(DS(DS))>70 N S DST=DST_" "_DS(DS) Q
K DS S DST=DST_$E(":",DICNT) D %
Q
;
ASKCUR ; Ask if user wants to see existing entries
N A1 S DDH=DDH+1,A1=0_U_$$EZBLD^DIALOG(8064)
I DO(2)'["s",'$D(DIC("S")),'$D(DIC("V")),'$D(DF),'$D(DIC("?PARAM",DIFILEI)) S A1=A1_$$EZBLD^DIALOG(8065,DICNT)
S DDH(DDH,"Q")=A1_$$EZBLD^DIALOG(8066,$P(DO,U))
S:$D(DDS) DDD=1 D ^DDSU
I '$D(DDS),$D(DTOUT) S (DIOUT,DIDONE)=1 Q
I $D(DDS) S %=1 I $D(DDSQ) S (DIOUT,DIDONE)=1 Q
; Process answer to question about seeing existing entries.
S A1="T",DDH=+$G(DDH)
S:%=1 %Y=1
I %Y'="??" D
. N F S F=$E(%Y,2,99) I $E(%Y)="^",F]"" S DIFROM=F
. S %Y=F Q
S:%=2&(DIC(0)["L") DZ=""
I (%#2)=0!(%<0&(%Y="")) S (DIOUT,DIDONE)=1 Q
I DIFROM="" S DIOUT=1 Q
S DIUPRITE=$S(+$P(DIFROM,"E")=DIFROM:1,DIBEGIX]"":0,1:DIUPRITE)
I +$P(DIFROM,"E")=DIFROM S DIOUT=1 Q
Q:DIBEGIX="" I $P(DIW,U,1)'["D" S DIOUT=1 Q
N %DT,Y S X=DIFROM,%DT="T" D ^%DT S DIFROM=Y,DIUPRITE=0
I DIFROM<0 S DST=$C(7) D % Q
S DIOUT=1 Q
;
DSPHLP(DIC,DIFILE,DINDEX,DZ,DINOKILL) ; Display online help for lookups (^DIC)
N D S D=DINDEX
I $D(DIBTDH) K DIBTDH Q
S:$D(DDSXEC) DIBTDH=1 ; Set only if there is eXecutable Help to prevent repeated '??' display from AST^DIEQ
I DIC(0)]"" D DQ Q:$G(DINOKILL)
I '$D(DDS),$G(DDH) D ^DDSU
I $D(DTOUT) S Y=-1 D Q^DIC2 Q
D A^DIC Q
;
N D % S DST=" " Q
;
% ;CALLED FROM ^DICQ1
S DDH=$G(DDH)+1,DDH(DDH,"T")=DST K DST Q
;
0 Q:$D(DTOUT)!(DIC(0)'["L") K DIW,DIUPRITE S:$D(DDS) DDD=1 D 0^DICQ1 Q
;
DIY S DIY=$P(^DD(+$P(DIY,U,2),.01,0),"$L(X)>",2),DIY=$S(DIY:DIY,1:30)+7 Q
;
SOUNDEX G DQ1
;
DS S:DO'[X DS(DS)=X I DO[X,$G(DZ)'["??" S DS(0)=1
Q
;
;
;
;#8063 Answer with |Filename|
;#8064 Do you want the entire
;#8065 |Number of entries| Entry
;#8066 |Filename| List
;#8067 , or
;#8068 Choose from ; couldn't find a reference SO 8/11/00
DICQ ;SFISC/XAK,TKW-HELP FOR LOOKUPS ;7:20 AM 17 May 2007
+1 ;;22.0;VA FileMan;**4,3,57,151**;Mar 30, 1999;Build 10
+2 ;Per VHA Directive 2004-038, this routine should not be modified.
+3 SET DZ=X
IF DIC(0)]""
DO DQ
+4 IF '$DATA(DDS)
IF $GET(DDH)
DO ^DDSU
+5 IF $DATA(DZ)
SET X=DZ
KILL DZ,DDH,DIZ,DDD
IF $DATA(DTOUT)
SET Y=-1
DO Q^DIC2
QUIT
+6 DO A^DIC
QUIT
+7 ;
DQ ; Main entry point for displaying online ^DIC help (list of current
+1 ; entries in a file.
+2 NEW %,%Y,X,Y,DD,DDC,DDD,DS,DID01,DICNT,DIDONE,DIFROM,DIPART,DIW,DIX,DIY,DIZ,DIUPRITE,DST,DIBEGSUB,DIBEGIX
+3 IF $DATA(DZ)[0
NEW DZ
SET DZ=""
+4 SET DDC=$SELECT($DATA(DDS):7,1:15)
+5 IF '$DATA(DDH)
NEW DDH
SET DDH=+$GET(DDH)
+6 SET DIBEGIX=D
+7 IF '($DATA(DIRECUR)#2)
NEW DIRECUR
SET DIRECUR=0
+8 IF '$DATA(DO)
NEW DO
DO GETFA^DIC1(.DIC,.DO)
+9 IF DO="0^-1"
KILL DO
SET DST=" Pointed-to File does not exist!"
DO %
QUIT
+10 SET DICNT=$PIECE(DO,U,4)
SET DIY=DO
DO DIY
+11 SET X=$SELECT($DATA(^DD(+DO(2),.001,0)):$PIECE(^(0),U,1),DIC(0)["N":"NUMBER",1:"")
SET DIUPRITE=X]""
+12 SET DIW=^DD(+DO(2),.01,0)
SET DIW=$PIECE(DIW,U,2,3)
+13 IF $DATA(^DD(+DO(2),0,"QUES"))
GOTO @^("QUES")
+14 IF DIUPRITE
SET DS=.001
DO DS
DQ1 IF $GET(DIFILEI)
IF $GET(DINDEX)]""
MERGE DIX=DINDEX
+1 IF '$TEST
NEW DIFILEI,DIENS
KILL %
MERGE %=DA
NEW DA
MERGE DA=%
KILL %
Begin DoDot:1
+2 DO GETFILE^DIC0(.DIC,.DIFILEI,.DIENS)
+3 SET DIX=$GET(D)
SET DIX("WAY")=1
DO INDEX^DICUIX(.DIFILEI,"hl",.DIX)
+4 QUIT
End DoDot:1
+5 SET DIBEGSUB=DIX("#")
+6 IF DIFILEI=""
DO %
QUIT
+7 IF $DATA(DIC("?N",DIFILEI))
SET DDC=DIC("?N",DIFILEI)
+8 SET DIFROM=""
+9 NEW DISAVIX
MERGE DISAVIX=DIX
+10 DO IX
KILL DISAVIX
+11 IF 'DICNT
DO 0
QUIT
+12 SET DIDONE=0
IF DZ'="??"
Begin DoDot:1
+13 DO DSPFLD
IF DICNT<11
QUIT
+14 NEW DIOUT
SET DIOUT=0
FOR
DO ASKCUR
IF DIOUT
QUIT
+15 QUIT
End DoDot:1
IF DIDONE
DO 0
QUIT
+16 DO EN^DICQ1
+17 QUIT
+18 ;
IX NEW DD,DIF,DIFIL,DIFLD,DIFORCE,DIEND,DITMP,I,P,F,X,%
+1 SET (DD,%)=""
SET DID01=0
SET DIF="h"_$PIECE("M^",U,DIC(0)["M")
+2 SET DIFORCE=$SELECT($DATA(DID):1,1:0)
SET DIFORCE(0)=$SELECT($DATA(DID):DID,1:"*")
SET DIFORCE(1)=1
+3 FOR
Begin DoDot:1
+4 SET DIEND=$SELECT(DIX=DIBEGIX:DIX("#"),1:1)
+5 SET (P,DS)=""
FOR I=1:1:DIEND
Begin DoDot:2
+6 SET DIFIL=$GET(DIX(I,"FILE"))
SET DIFLD=$GET(DIX(I,"FIELD"))
+7 IF DIFIL
IF DIFLD
IF $DATA(DITMP(DIFIL,DIFLD))
QUIT
SET DITMP(DIFIL,DIFLD)=""
+8 IF DIX=DIBEGIX
Begin DoDot:3
+9 IF DIFIL=DIFILEI
IF DIFLD=.01
IF DIX("FLISTD")[("^"_.01_"^")
SET DID01=1
+10 SET DS=.002
QUIT
End DoDot:3
+11 IF '$TEST
SET X=DIFLD
IF DIFILEI'=DIFIL
SET X=DIFIL_" "_DIFLD
IF DS]""
SET DS=DS_"^"
SET DS=DS_X
+12 SET X=$GET(DIX(I,"PROMPT"))
+13 IF X=""
IF $DATA(^DD(+DIFIL,+DIFLD,0))#2
SET X=$PIECE(^(0),U)
+14 IF I=1
SET %=DIX(1,"TYPE")
+15 IF X=""
QUIT
IF DIX("#")=1
IF X=$GET(DS(.002))
QUIT
+16 IF $LENGTH(X)+$LENGTH(P)'>70
SET P=P_$PIECE(" & ^",U,P]"")_X
QUIT
+17 IF P'["..."
SET P=P_"..."
QUIT
End DoDot:2
+18 IF P]""
IF DS]""
SET X=P
DO DS
+19 IF @("$D("_DIC_"DIX))>9!$D(DF)")
IF DD=""
SET DD=DIX
SET DIW=%
IF 'DICNT
SET DICNT=2
IF '$DATA(^(DD))
SET DICNT=0
SET DIUPRITE=0
+20 IF DIC(0)'["M"
SET DIX=""
QUIT
+21 DO NXTINDX^DICF2(.DIX,.DIFORCE,.DIFILEI,DIF,"","*")
IF DIX=""
QUIT
+22 DO INDEX^DICUIX(.DIFILEI,"hql",.DIX)
QUIT
End DoDot:1
IF DIX=""!(DIC(0)'["M")
QUIT
+23 KILL DIX
+24 IF DIBEGIX=DD
MERGE DIX=DISAVIX
+25 IF '$TEST
SET (DIBEGIX,DIX)=DD
IF DIX]""
SET DIX("WAY")=1
DO INDEX^DICUIX(.DIFILEI,"hl",.DIX)
+26 IF DD=""
SET DIUPRITE=1
IF $ORDER(^DD(DIFILEI,0,"IX","AZ"))]""!($ORDER(^DD("IX","BB",DIFILEI,"AZ"))]"")
SET DICNT=0
+27 IF DZ["BAD"
SET DICNT=0
+28 QUIT
+29 ;
DSPFLD ; Display list of lookup fields
+1 NEW X
SET DST=$$EZBLD^DIALOG(8063,$PIECE(DO,U))
SET DS=0
+2 FOR X=1:1
SET DS=$ORDER(DS(DS))
IF DS=""
QUIT
Begin DoDot:1
+3 IF X>1!$GET(DS(0))
SET DST=DST_$$EZBLD^DIALOG(8067)
+4 IF $LENGTH(DST)+$LENGTH(DS(DS))>70
DO N
SET DST=DST_" "_DS(DS)
QUIT
End DoDot:1
+5 KILL DS
SET DST=DST_$EXTRACT(":",DICNT)
DO %
+6 QUIT
+7 ;
ASKCUR ; Ask if user wants to see existing entries
+1 NEW A1
SET DDH=DDH+1
SET A1=0_U_$$EZBLD^DIALOG(8064)
+2 IF DO(2)'["s"
IF '$DATA(DIC("S"))
IF '$DATA(DIC("V"))
IF '$DATA(DF)
IF '$DATA(DIC("?PARAM",DIFILEI))
SET A1=A1_$$EZBLD^DIALOG(8065,DICNT)
+3 SET DDH(DDH,"Q")=A1_$$EZBLD^DIALOG(8066,$PIECE(DO,U))
+4 IF $DATA(DDS)
SET DDD=1
DO ^DDSU
+5 IF '$DATA(DDS)
IF $DATA(DTOUT)
SET (DIOUT,DIDONE)=1
QUIT
+6 IF $DATA(DDS)
SET %=1
IF $DATA(DDSQ)
SET (DIOUT,DIDONE)=1
QUIT
+7 ; Process answer to question about seeing existing entries.
+8 SET A1="T"
SET DDH=+$GET(DDH)
+9 IF %=1
SET %Y=1
+10 IF %Y'="??"
Begin DoDot:1
+11 NEW F
SET F=$EXTRACT(%Y,2,99)
IF $EXTRACT(%Y)="^"
IF F]""
SET DIFROM=F
+12 SET %Y=F
QUIT
End DoDot:1
+13 IF %=2&(DIC(0)["L")
SET DZ=""
+14 IF (%#2)=0!(%<0&(%Y=""))
SET (DIOUT,DIDONE)=1
QUIT
+15 IF DIFROM=""
SET DIOUT=1
QUIT
+16 SET DIUPRITE=$SELECT(+$PIECE(DIFROM,"E")=DIFROM:1,DIBEGIX]"":0,1:DIUPRITE)
+17 IF +$PIECE(DIFROM,"E")=DIFROM
SET DIOUT=1
QUIT
+18 IF DIBEGIX=""
QUIT
IF $PIECE(DIW,U,1)'["D"
SET DIOUT=1
QUIT
+19 NEW %DT,Y
SET X=DIFROM
SET %DT="T"
DO ^%DT
SET DIFROM=Y
SET DIUPRITE=0
+20 IF DIFROM<0
SET DST=$CHAR(7)
DO %
QUIT
+21 SET DIOUT=1
QUIT
+22 ;
DSPHLP(DIC,DIFILE,DINDEX,DZ,DINOKILL) ; Display online help for lookups (^DIC)
+1 NEW D
SET D=DINDEX
+2 IF $DATA(DIBTDH)
KILL DIBTDH
QUIT
+3 ; Set only if there is eXecutable Help to prevent repeated '??' display from AST^DIEQ
IF $DATA(DDSXEC)
SET DIBTDH=1
+4 IF DIC(0)]""
DO DQ
IF $GET(DINOKILL)
QUIT
+5 IF '$DATA(DDS)
IF $GET(DDH)
DO ^DDSU
+6 IF $DATA(DTOUT)
SET Y=-1
DO Q^DIC2
QUIT
+7 DO A^DIC
QUIT
+8 ;
N DO %
SET DST=" "
QUIT
+1 ;
% ;CALLED FROM ^DICQ1
+1 SET DDH=$GET(DDH)+1
SET DDH(DDH,"T")=DST
KILL DST
QUIT
+2 ;
0 IF $DATA(DTOUT)!(DIC(0)'["L")
QUIT
KILL DIW,DIUPRITE
IF $DATA(DDS)
SET DDD=1
DO 0^DICQ1
QUIT
+1 ;
DIY SET DIY=$PIECE(^DD(+$PIECE(DIY,U,2),.01,0),"$L(X)>",2)
SET DIY=$SELECT(DIY:DIY,1:30)+7
QUIT
+1 ;
SOUNDEX GOTO DQ1
+1 ;
DS IF DO'[X
SET DS(DS)=X
IF DO[X
IF $GET(DZ)'["??"
SET DS(0)=1
+1 QUIT
+2 ;
+3 ;
+4 ;
+5 ;#8063 Answer with |Filename|
+6 ;#8064 Do you want the entire
+7 ;#8065 |Number of entries| Entry
+8 ;#8066 |Filename| List
+9 ;#8067 , or
+10 ;#8068 Choose from ; couldn't find a reference SO 8/11/00