DDS2 ;SFISC/MLH-UP ARROW JUMP, BRANCH ;10:46 AM 17 Jun 1997
;;22.0;VA FileMan;;Mar 30, 1999
;Per VHA Directive 10-93-142, this routine should not be modified.
UPA ;Up-arrow jump
Q:$E(X)'=U
I X?1"^"1.E,X'="^^",$G(DDSDN) D MSG^DDSMSG("No jumping allowed.",1) Q
I X?1"^"1.E,X'="^^" D JMP Q
;
;Up-arrow only
I 'DDO D E^DDS3 Q
I $D(DDSREP),DA D POSTACT D:$D(DDSBR)[0 END^DDSM Q
I $G(DDSDN)=1 D MSG^DDSMSG("No exit allowed, since navigation for the block is disabled.",1) Q
D POSTACT S:$D(DDSBR)[0 DDSOSV=DDO,DDO=0 Q
Q
;
POSTACT ;Execute post action
Q:$G(DDSO(12))?." "
N X
S X=$G(DDSOLD) X DDSO(12)
D:$D(DDSBR)#2 BR
Q
;
JMP ;Up-arrow jump
S DDS2X=X,X=$P(X,U,2) I X="" W $C(7) G KILL
K DDH,DDQ S DDH=0
S (X,DDSX)=$$UPCASE($E(X,1,63))
;
;Find exact matches
D:$D(@DDSREFS@("CAP",X)) CAP
D:$D(@DDSREFT@("XCAP",DDSPG,X)) XCAP
;
;Find partial matches
S:X="?" (X,DDSX)=""
F S DDSX=$O(@DDSREFS@("CAP",DDSX)) Q:DDSX=""!($P(DDSX,X)]"") D CAP
S DDSX=X F S DDSX=$O(@DDSREFT@("XCAP",DDSPG,DDSX)) Q:DDSX=""!($P(DDSX,X)]"") D XCAP
;
I 'DDH D MSG^DDSMSG($P(DDS2X,U,2)_" not found.",1) G KILL
S DDS2O=DDO
I DDH=1 S DDO=$O(DDH(DDH,""))
E S DDD="J" D SC^DDSU
;
S DDS2B=$P(DDO,",",2),DDS2P=$P(DDO,",",3),DDO=+DDO
G:'DDS2B KILL
;
S DDS2DA=DDSDA
I DDS2P'=DDSPG D
. D:'$D(@DDSREFT@(DDS2P,DDS2B)) ^DDS1(DDS2P)
. S DDS2DA=@DDSREFT@(DDS2P,DDS2B)
. I DDS2DA="" D
.. D MSG^DDSMSG($C(7)_$P($T(ERR),";;",2))
.. S DDO=DDS2O
. E D CKUNED D:'$G(DDS2UNED)
.. D POSTACT
.. S:$D(DDSBR)[0 DDACT="NP",DDSPG=DDS2P,DDSBK=DDS2B,DDSBR=""
;
E I DDS2B'=DDSBK D
. S DDS2DA=@DDSREFT@(DDS2P,DDS2B)
. I DDS2DA="" D
.. D MSG^DDSMSG($C(7)_$P($T(ERR),";;",2))
.. S DDO=DDS2O
. E I $P($G(@DDSREFS@(DDS2P,DDS2B)),U,4) D
.. D MSG^DDSMSG($C(7)_$P($T(ERR1),";;",2))
.. S DDO=DDS2O
. E D CKUNED D:'$G(DDS2UNED)
.. D POSTACT
.. S:$D(DDSBR)[0 DDACT="NB",DDSBK=DDS2B,DDSBR=""
;
E D CKUNED D:'$G(DDS2UNED)
. D POSTACT
. S:$D(DDSBR)[0 DDACT="N"
;
KILL S X=DDS2X
K DDH,DDSI,DDSPGRP,DDSX
K DDS2ATT,DDS2B,DDS2DA,DDS2F,DDS2O,DDS2P,DDS2UNED,DDS2X
Q
;
CKUNED ;Check uneditable status
N DDP,DDSFLD
;
I $P($G(^DIST(.404,DDS2B,40,+DDO,0)),U,3)=2 D
. S DDP=0
. S DDSFLD=+DDO_","_DDS2B
E D
. S DDP=$P($G(@DDSREFS@(DDS2P,DDS2B)),U,3)
. S DDSFLD=$P($G(^DIST(.404,DDS2B,40,+DDO,1)),U)
;
S DDS2ATT=$P($G(@DDSREFT@("F"_DDP,DDS2DA,DDSFLD,"A")),U,4)
;
I DDO,$S(DDS2ATT="":$P($G(^DIST(.404,DDS2B,40,+DDO,4)),U,4)=1,1:DDS2ATT=1),'$P(@DDSREFS@(DDS2P,DDS2B,+DDO,"N"),U,11) D
. D MSG^DDSMSG($P(^DIST(.404,DDS2B,40,+DDO,0),U,2)_" is uneditable.",1)
. S DDS2UNED=1,DDO=DDS2O
Q
;
CAP ;Find all captions that match DDSX
S DDSPGRP="" F S DDSPGRP=$O(@DDSREFS@("CAP",DDSX,DDSPGRP)) Q:DDSPGRP="" D
. Q:U_DDSPGRP_U'[(U_DDSPG_U)
. S DDS2P="" F S DDS2P=$O(@DDSREFS@("CAP",DDSX,DDSPGRP,DDS2P)) Q:'DDS2P D
.. S DDS2B="" F S DDS2B=$O(@DDSREFS@("CAP",DDSX,DDSPGRP,DDS2P,DDS2B)) Q:'DDS2B D
... S DDS2F="" F S DDS2F=$O(@DDSREFS@("CAP",DDSX,DDSPGRP,DDS2P,DDS2B,DDS2F)) Q:'DDS2F D FILL
Q
;
XCAP ;Find all xecutable captions that match DDSX
S DDS2P=DDSPG
S DDS2B=0 F S DDS2B=$O(@DDSREFT@("XCAP",DDSPG,DDSX,DDS2B)) Q:'DDS2B D
. S DDS2F=0 F S DDS2F=+$O(@DDSREFT@("XCAP",DDSPG,DDSX,DDS2B,DDS2F)) Q:'DDS2F D
.. I $D(^DIST(.404,DDS2B,40,DDS2F,0))#2,$P(^(0),U,3)'=1 D FILL
Q
;
FILL ;Fill DDH array with possible choices
S DDS2V=DDSX_$S($P(^DIST(.404,DDS2B,40,DDS2F,0),U,4)]"":" ("_$P(^(0),U,4)_")",1:"")
S:DDS2P'=DDSPG DDS2V=DDS2V_" ("_$S($P($G(^DIST(.403,+DDS,40,DDS2P,1)),U)]"":$P(^(1),U),1:"Page "_$P(^(0),U))_")"
S DDH=DDH+1,DDH(DDH,DDS2F_","_DDS2B_","_DDS2P)=DDS2V
K DDS2V
Q
;
BR ;Evaluate DDSBR
N B,B1,F,F1,P,P1,E,X Q:$D(DDSBR)[0
S P=$P($G(DDSOPB),U),B=$P($G(DDSOPB),U,2),F=$G(DDO),E=1
S:'B B=+$P(@DDSREFS@(+P,"FIRST"),",",2)
S P1=$P(DDSBR,U,3),B1=$P(DDSBR,U,2),F1=$P(DDSBR,U)
;
D @$S(P1]"":"PG",B1]"":"BK",1:"FD")
S:'E DDACT=$S(P'=+DDSOPB:"NP",B'=$P(DDSOPB,U,2):"NB",1:"N"),DDSPG=P,DDSBK=B,DDO=F
K:E DDSBR
Q
PG ;
I P1=+$P(P1,"E") S P=$O(^DIST(.403,+DDS,40,"B",P1,""))
E S P=$O(^DIST(.403,+DDS,40,"C",$$UPCASE(P1),""))
Q:'P
S:B1="" B1=$O(^DIST(.403,+DDS,40,P,40,"AC","")) Q:B1=""
BK ;
I B1=+$P(B1,"E") D
. S B=$O(^DIST(.403,+DDS,40,P,40,"AC",B1,""))
E D
. S B=$O(^DIST(.404,"B",B1,"")) Q:B=""
. S B=$O(^DIST(.403,+DDS,40,P,40,"B",B,""))
Q:'B
S:F1="" F1=$O(^DIST(.404,B,40,"B",""))
FD ;
Q:F1=""
I F1="COM" S (E,F)=0 Q
I F1=+$P(F1,"E") S X="B"
E S F1=$$UPCASE(F1),X=$S($D(^DIST(.404,B,40,"D",F1)):"D",1:"C")
S F=$O(^DIST(.404,B,40,X,F1,""))
S:F E=0
Q
;
UPCASE(X) ;
;Return X in uppercase
Q $TR(X,"abcdefghijklmnopqrstuvwxyz","ABCDEFGHIJKLMNOPQRSTUVWXYZ")
;
ERR ;;Unable to jump to that field. The block on which that field is located has no record associated with it.
;
ERR1 ;;Unable to jump to that field. The block on which that field is located has navigation disabled.
DDS2 ;SFISC/MLH-UP ARROW JUMP, BRANCH ;10:46 AM 17 Jun 1997
+1 ;;22.0;VA FileMan;;Mar 30, 1999
+2 ;Per VHA Directive 10-93-142, this routine should not be modified.
UPA ;Up-arrow jump
+1 IF $EXTRACT(X)'=U
QUIT
+2 IF X?1"^"1.E
IF X'="^^"
IF $GET(DDSDN)
DO MSG^DDSMSG("No jumping allowed.",1)
QUIT
+3 IF X?1"^"1.E
IF X'="^^"
DO JMP
QUIT
+4 ;
+5 ;Up-arrow only
+6 IF 'DDO
DO E^DDS3
QUIT
+7 IF $DATA(DDSREP)
IF DA
DO POSTACT
IF $DATA(DDSBR)[0
DO END^DDSM
QUIT
+8 IF $GET(DDSDN)=1
DO MSG^DDSMSG("No exit allowed, since navigation for the block is disabled.",1)
QUIT
+9 DO POSTACT
IF $DATA(DDSBR)[0
SET DDSOSV=DDO
SET DDO=0
QUIT
+10 QUIT
+11 ;
POSTACT ;Execute post action
+1 IF $GET(DDSO(12))?." "
QUIT
+2 NEW X
+3 SET X=$GET(DDSOLD)
XECUTE DDSO(12)
+4 IF $DATA(DDSBR)#2
DO BR
+5 QUIT
+6 ;
JMP ;Up-arrow jump
+1 SET DDS2X=X
SET X=$PIECE(X,U,2)
IF X=""
WRITE $CHAR(7)
GOTO KILL
+2 KILL DDH,DDQ
SET DDH=0
+3 SET (X,DDSX)=$$UPCASE($EXTRACT(X,1,63))
+4 ;
+5 ;Find exact matches
+6 IF $DATA(@DDSREFS@("CAP",X))
DO CAP
+7 IF $DATA(@DDSREFT@("XCAP",DDSPG,X))
DO XCAP
+8 ;
+9 ;Find partial matches
+10 IF X="?"
SET (X,DDSX)=""
+11 FOR
SET DDSX=$ORDER(@DDSREFS@("CAP",DDSX))
IF DDSX=""!($PIECE(DDSX,X)]"")
QUIT
DO CAP
+12 SET DDSX=X
FOR
SET DDSX=$ORDER(@DDSREFT@("XCAP",DDSPG,DDSX))
IF DDSX=""!($PIECE(DDSX,X)]"")
QUIT
DO XCAP
+13 ;
+14 IF 'DDH
DO MSG^DDSMSG($PIECE(DDS2X,U,2)_" not found.",1)
GOTO KILL
+15 SET DDS2O=DDO
+16 IF DDH=1
SET DDO=$ORDER(DDH(DDH,""))
+17 IF '$TEST
SET DDD="J"
DO SC^DDSU
+18 ;
+19 SET DDS2B=$PIECE(DDO,",",2)
SET DDS2P=$PIECE(DDO,",",3)
SET DDO=+DDO
+20 IF 'DDS2B
GOTO KILL
+21 ;
+22 SET DDS2DA=DDSDA
+23 IF DDS2P'=DDSPG
Begin DoDot:1
+24 IF '$DATA(@DDSREFT@(DDS2P,DDS2B))
DO ^DDS1(DDS2P)
+25 SET DDS2DA=@DDSREFT@(DDS2P,DDS2B)
+26 IF DDS2DA=""
Begin DoDot:2
+27 DO MSG^DDSMSG($CHAR(7)_$PIECE($TEXT(ERR),";;",2))
+28 SET DDO=DDS2O
End DoDot:2
+29 IF '$TEST
DO CKUNED
IF '$GET(DDS2UNED)
Begin DoDot:2
+30 DO POSTACT
+31 IF $DATA(DDSBR)[0
SET DDACT="NP"
SET DDSPG=DDS2P
SET DDSBK=DDS2B
SET DDSBR=""
End DoDot:2
End DoDot:1
+32 ;
+33 IF '$TEST
IF DDS2B'=DDSBK
Begin DoDot:1
+34 SET DDS2DA=@DDSREFT@(DDS2P,DDS2B)
+35 IF DDS2DA=""
Begin DoDot:2
+36 DO MSG^DDSMSG($CHAR(7)_$PIECE($TEXT(ERR),";;",2))
+37 SET DDO=DDS2O
End DoDot:2
+38 IF '$TEST
IF $PIECE($GET(@DDSREFS@(DDS2P,DDS2B)),U,4)
Begin DoDot:2
+39 DO MSG^DDSMSG($CHAR(7)_$PIECE($TEXT(ERR1),";;",2))
+40 SET DDO=DDS2O
End DoDot:2
+41 IF '$TEST
DO CKUNED
IF '$GET(DDS2UNED)
Begin DoDot:2
+42 DO POSTACT
+43 IF $DATA(DDSBR)[0
SET DDACT="NB"
SET DDSBK=DDS2B
SET DDSBR=""
End DoDot:2
End DoDot:1
+44 ;
+45 IF '$TEST
DO CKUNED
IF '$GET(DDS2UNED)
Begin DoDot:1
+46 DO POSTACT
+47 IF $DATA(DDSBR)[0
SET DDACT="N"
End DoDot:1
+48 ;
KILL SET X=DDS2X
+1 KILL DDH,DDSI,DDSPGRP,DDSX
+2 KILL DDS2ATT,DDS2B,DDS2DA,DDS2F,DDS2O,DDS2P,DDS2UNED,DDS2X
+3 QUIT
+4 ;
CKUNED ;Check uneditable status
+1 NEW DDP,DDSFLD
+2 ;
+3 IF $PIECE($GET(^DIST(.404,DDS2B,40,+DDO,0)),U,3)=2
Begin DoDot:1
+4 SET DDP=0
+5 SET DDSFLD=+DDO_","_DDS2B
End DoDot:1
+6 IF '$TEST
Begin DoDot:1
+7 SET DDP=$PIECE($GET(@DDSREFS@(DDS2P,DDS2B)),U,3)
+8 SET DDSFLD=$PIECE($GET(^DIST(.404,DDS2B,40,+DDO,1)),U)
End DoDot:1
+9 ;
+10 SET DDS2ATT=$PIECE($GET(@DDSREFT@("F"_DDP,DDS2DA,DDSFLD,"A")),U,4)
+11 ;
+12 IF DDO
IF $SELECT(DDS2ATT="":$PIECE($GET(^DIST(.404,DDS2B,40,+DDO,4)),U,4)=1,1:DDS2ATT=1)
IF '$PIECE(@DDSREFS@(DDS2P,DDS2B,+DDO,"N"),U,11)
Begin DoDot:1
+13 DO MSG^DDSMSG($PIECE(^DIST(.404,DDS2B,40,+DDO,0),U,2)_" is uneditable.",1)
+14 SET DDS2UNED=1
SET DDO=DDS2O
End DoDot:1
+15 QUIT
+16 ;
CAP ;Find all captions that match DDSX
+1 SET DDSPGRP=""
FOR
SET DDSPGRP=$ORDER(@DDSREFS@("CAP",DDSX,DDSPGRP))
IF DDSPGRP=""
QUIT
Begin DoDot:1
+2 IF U_DDSPGRP_U'[(U_DDSPG_U)
QUIT
+3 SET DDS2P=""
FOR
SET DDS2P=$ORDER(@DDSREFS@("CAP",DDSX,DDSPGRP,DDS2P))
IF 'DDS2P
QUIT
Begin DoDot:2
+4 SET DDS2B=""
FOR
SET DDS2B=$ORDER(@DDSREFS@("CAP",DDSX,DDSPGRP,DDS2P,DDS2B))
IF 'DDS2B
QUIT
Begin DoDot:3
+5 SET DDS2F=""
FOR
SET DDS2F=$ORDER(@DDSREFS@("CAP",DDSX,DDSPGRP,DDS2P,DDS2B,DDS2F))
IF 'DDS2F
QUIT
DO FILL
End DoDot:3
End DoDot:2
End DoDot:1
+6 QUIT
+7 ;
XCAP ;Find all xecutable captions that match DDSX
+1 SET DDS2P=DDSPG
+2 SET DDS2B=0
FOR
SET DDS2B=$ORDER(@DDSREFT@("XCAP",DDSPG,DDSX,DDS2B))
IF 'DDS2B
QUIT
Begin DoDot:1
+3 SET DDS2F=0
FOR
SET DDS2F=+$ORDER(@DDSREFT@("XCAP",DDSPG,DDSX,DDS2B,DDS2F))
IF 'DDS2F
QUIT
Begin DoDot:2
+4 IF $DATA(^DIST(.404,DDS2B,40,DDS2F,0))#2
IF $PIECE(^(0),U,3)'=1
DO FILL
End DoDot:2
End DoDot:1
+5 QUIT
+6 ;
FILL ;Fill DDH array with possible choices
+1 SET DDS2V=DDSX_$SELECT($PIECE(^DIST(.404,DDS2B,40,DDS2F,0),U,4)]"":" ("_$PIECE(^(0),U,4)_")",1:"")
+2 IF DDS2P'=DDSPG
SET DDS2V=DDS2V_" ("_$SELECT($PIECE($GET(^DIST(.403,+DDS,40,DDS2P,1)),U)]"":$PIECE(^(1),U),1:"Page "_$PIECE(^(0),U))_")"
+3 SET DDH=DDH+1
SET DDH(DDH,DDS2F_","_DDS2B_","_DDS2P)=DDS2V
+4 KILL DDS2V
+5 QUIT
+6 ;
BR ;Evaluate DDSBR
+1 NEW B,B1,F,F1,P,P1,E,X
IF $DATA(DDSBR)[0
QUIT
+2 SET P=$PIECE($GET(DDSOPB),U)
SET B=$PIECE($GET(DDSOPB),U,2)
SET F=$GET(DDO)
SET E=1
+3 IF 'B
SET B=+$PIECE(@DDSREFS@(+P,"FIRST"),",",2)
+4 SET P1=$PIECE(DDSBR,U,3)
SET B1=$PIECE(DDSBR,U,2)
SET F1=$PIECE(DDSBR,U)
+5 ;
+6 DO @$SELECT(P1]"":"PG",B1]"":"BK",1:"FD")
+7 IF 'E
SET DDACT=$SELECT(P'=+DDSOPB:"NP",B'=$PIECE(DDSOPB,U,2):"NB",1:"N")
SET DDSPG=P
SET DDSBK=B
SET DDO=F
+8 IF E
KILL DDSBR
+9 QUIT
PG ;
+1 IF P1=+$PIECE(P1,"E")
SET P=$ORDER(^DIST(.403,+DDS,40,"B",P1,""))
+2 IF '$TEST
SET P=$ORDER(^DIST(.403,+DDS,40,"C",$$UPCASE(P1),""))
+3 IF 'P
QUIT
+4 IF B1=""
SET B1=$ORDER(^DIST(.403,+DDS,40,P,40,"AC",""))
IF B1=""
QUIT
BK ;
+1 IF B1=+$PIECE(B1,"E")
Begin DoDot:1
+2 SET B=$ORDER(^DIST(.403,+DDS,40,P,40,"AC",B1,""))
End DoDot:1
+3 IF '$TEST
Begin DoDot:1
+4 SET B=$ORDER(^DIST(.404,"B",B1,""))
IF B=""
QUIT
+5 SET B=$ORDER(^DIST(.403,+DDS,40,P,40,"B",B,""))
End DoDot:1
+6 IF 'B
QUIT
+7 IF F1=""
SET F1=$ORDER(^DIST(.404,B,40,"B",""))
FD ;
+1 IF F1=""
QUIT
+2 IF F1="COM"
SET (E,F)=0
QUIT
+3 IF F1=+$PIECE(F1,"E")
SET X="B"
+4 IF '$TEST
SET F1=$$UPCASE(F1)
SET X=$SELECT($DATA(^DIST(.404,B,40,"D",F1)):"D",1:"C")
+5 SET F=$ORDER(^DIST(.404,B,40,X,F1,""))
+6 IF F
SET E=0
+7 QUIT
+8 ;
UPCASE(X) ;
+1 ;Return X in uppercase
+2 QUIT $TRANSLATE(X,"abcdefghijklmnopqrstuvwxyz","ABCDEFGHIJKLMNOPQRSTUVWXYZ")
+3 ;
ERR ;;Unable to jump to that field. The block on which that field is located has no record associated with it.
+1 ;
ERR1 ;;Unable to jump to that field. The block on which that field is located has navigation disabled.