DICE2 ;SFISC/GFT-TRIGGER LOGIC ;09:41 AM 10 Jul 1999
;;22.2;VA FileMan;;Jan 05, 2016;Build 42
;;Per VA Directive 6402, this routine should not be modified.
;;Submitted to OSEHRA 5 January 2015 by the VISTA Expertise Network.
;;Based on Medsphere Systems Corporation's MSC FileMan 1051.
;;Licensed under the terms of the Apache License, Version 2.0.
;
Q:$D(DTOUT) W !!!,"---",$P("SET^KILL",U,DIK)," LOGIC---" S DA="^DD("_DI_","_DL_",1,"_DQ_","_(DIK+3)
C K DICOMPX,DATE S:DOLD=DNEW DNEW="TRIGGERED "_DNEW S DNEW=$E(DNEW,1,30),DICOMPX(DNEW)="DIU",DICOMPX(DNEW,U)=DIN_U_DENEW,DCOND="SET" S:$P(^DD(DIN,DENEW,0),U,2)["D" DICOMPX(DNEW,"DATE")=1
W !!,"IN ANSWERING THE FOLLOWING QUESTION, '"_DNEW_"'",!?2,"CAN BE USED TO REFER TO THE EXISTING TRIGGERED FIELD VALUE.",!
S DICOMP="?",DICOMPX="",%=DIN S:DIK=1 DICOMPX(1,DI,DL)="DIV"
D OLD W "PLEASE ENTER AN EXPRESSION WHICH WILL BECOME THE VALUE OF THE",! S %F=DENEW D WR^DIDH
D GET Q:U[X I X="""@""" K X G DICE2^DIQQ
I X="@" S X="S X="""""
E D ^DICOMP G DICE2^DIQQ:'$D(X) F %=9.2:.1 Q:'$D(X(%)) S ^UTILITY("DICE",$J,DIK+3*10+%)=X(%)
K DICOMPX(DNEW) I X="S X=""""" S DE=X,DCOND="DELE" D DEL^DICE3 G Q:X=U,^DICE4:DENEW-.01 F X=0:1 G D01:'$D(J(X)) I J(X)=DIN W $C(7),!,"BUT THE TRIGGERING FIELD DEPENDS ON THE TRIGGERED FIELD!" S X=U G Q
S DE="S X=DIV "_X,%=$P(^DD(DIN,DENEW,0),U,2) I %["D",'Y["D" W $C(7),!,"WARNING -- THIS SHOULD PRODUCE A DATE VALUE, AND IT MAY NOT!"
S V=$P(%,"P",2) I V,DICOMPX-V!($P(DICOMPX,U,2)-.001) W !,$C(7),"WARNING -- THIS MUST BE '",$P(^DIC(+V,0),U)," NUMBER'!"
I Y["B" W $C(7),!,"WARNING--THIS TRUTH-VALUED EXPRESSION WILL PRODUCE ONLY VALUES OF '0' OR '1'"
I %'["D",Y["D" W $C(7),!,"WARNING -- THIS MAY PRODUCE A 'DATE', AND IT SHOULDN'T!"
D ^DICE3 G ^DICE4:X'=U
Q Q
;
OLD ;
I DIK=2 S X=$E("OLD "_DOLD,1,30),DICOMPX(X)="X",DICOMPX(X,U)=DI_U_DL W ?2,"NOTE: '"_X_"' CAN BE USED TO REFER TO THE VALUE OF THE",!?2,DOLD_" FIELD BEFORE ITS CHANGE OR DELETION.",! S:$P(^DD(DI,DL,0),U,2)["D" DICOMPX(X,"DATE")=1
Q
;
D01 S V=DREF,X=$L(V)-1 F %=X:-1 I "(,"[$E(V,%) S DHI=$E(V,%+1,X) I DHI'?1N1")" S V=$E(V,1,%),X=0 Q
DQ S X=$F(V,"""",X) I X>0 S V=$E(V,1,X-1)_""""_$E(V,X,999),X=X+2 G DQ
S X="I "_DHI_">0 N DIK S DIK(0)=DA,",V="DIK="""_V_""",",DHI="DA="_DHI_" D ^DIK",DTAG="S DA=DIK(0)"
F %=1:1:N S X=X_"DIK("_%_")=DA("_%_"),",DTAG=DTAG_",DA("_%_")=DIK("_%_")"
F %=1:1:A#100 S DHI="DA("_%_")=DIV("_(A#100-%)_"),"_DHI
S X=X_V_DHI,^UTILITY("DICE",$J,"DIK")="DELETE" G F^DICE4
;
GET ;
W !," WHENEVER THE '"_DOLD_"' FIELD IS "_$P("ENTERED OR CHANGED^CHANGED OR DELETED",U,DIK)
R ": ",X:DTIME S:'$T X=U S Y=X I X="" S Y="NO EFFECT",^UTILITY("DICE",$J,DIK)="Q" W " ",Y I DIK=2,^UTILITY("DICE",$J,1)="Q" W $C(7),"??" S X=U
S ^UTILITY("DICE",$J,$P("CREA^DELE",U,DIK)_"TE VALUE")=Y
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HDICE2 2806 printed Dec 13, 2024@02:45:55 Page 2
DICE2 ;SFISC/GFT-TRIGGER LOGIC ;09:41 AM 10 Jul 1999
+1 ;;22.2;VA FileMan;;Jan 05, 2016;Build 42
+2 ;;Per VA Directive 6402, this routine should not be modified.
+3 ;;Submitted to OSEHRA 5 January 2015 by the VISTA Expertise Network.
+4 ;;Based on Medsphere Systems Corporation's MSC FileMan 1051.
+5 ;;Licensed under the terms of the Apache License, Version 2.0.
+6 ;
+7 if $DATA(DTOUT)
QUIT
WRITE !!!,"---",$PIECE("SET^KILL",U,DIK)," LOGIC---"
SET DA="^DD("_DI_","_DL_",1,"_DQ_","_(DIK+3)
C KILL DICOMPX,DATE
if DOLD=DNEW
SET DNEW="TRIGGERED "_DNEW
SET DNEW=$EXTRACT(DNEW,1,30)
SET DICOMPX(DNEW)="DIU"
SET DICOMPX(DNEW,U)=DIN_U_DENEW
SET DCOND="SET"
if $PIECE(^DD(DIN,DENEW,0),U,2)["D"
SET DICOMPX(DNEW,"DATE")=1
+1 WRITE !!,"IN ANSWERING THE FOLLOWING QUESTION, '"_DNEW_"'",!?2,"CAN BE USED TO REFER TO THE EXISTING TRIGGERED FIELD VALUE.",!
+2 SET DICOMP="?"
SET DICOMPX=""
SET %=DIN
if DIK=1
SET DICOMPX(1,DI,DL)="DIV"
+3 DO OLD
WRITE "PLEASE ENTER AN EXPRESSION WHICH WILL BECOME THE VALUE OF THE",!
SET %F=DENEW
DO WR^DIDH
+4 DO GET
if U[X
QUIT
IF X="""@"""
KILL X
GOTO DICE2^DIQQ
+5 IF X="@"
SET X="S X="""""
+6 IF '$TEST
DO ^DICOMP
if '$DATA(X)
GOTO DICE2^DIQQ
FOR %=9.2:.1
if '$DATA(X(%))
QUIT
SET ^UTILITY("DICE",$JOB,DIK+3*10+%)=X(%)
+7 KILL DICOMPX(DNEW)
IF X="S X="""""
SET DE=X
SET DCOND="DELE"
DO DEL^DICE3
if X=U
GOTO Q
if DENEW-.01
GOTO ^DICE4
FOR X=0:1
if '$DATA(J(X))
GOTO D01
IF J(X)=DIN
WRITE $CHAR(7),!,"BUT THE TRIGGERING FIELD DEPENDS ON THE TRIGGERED FIELD!"
SET X=U
GOTO Q
+8 SET DE="S X=DIV "_X
SET %=$PIECE(^DD(DIN,DENEW,0),U,2)
IF %["D"
IF 'Y["D"
WRITE $CHAR(7),!,"WARNING -- THIS SHOULD PRODUCE A DATE VALUE, AND IT MAY NOT!"
+9 SET V=$PIECE(%,"P",2)
IF V
IF DICOMPX-V!($PIECE(DICOMPX,U,2)-.001)
WRITE !,$CHAR(7),"WARNING -- THIS MUST BE '",$PIECE(^DIC(+V,0),U)," NUMBER'!"
+10 IF Y["B"
WRITE $CHAR(7),!,"WARNING--THIS TRUTH-VALUED EXPRESSION WILL PRODUCE ONLY VALUES OF '0' OR '1'"
+11 IF %'["D"
IF Y["D"
WRITE $CHAR(7),!,"WARNING -- THIS MAY PRODUCE A 'DATE', AND IT SHOULDN'T!"
+12 DO ^DICE3
if X'=U
GOTO ^DICE4
Q QUIT
+1 ;
OLD ;
+1 IF DIK=2
SET X=$EXTRACT("OLD "_DOLD,1,30)
SET DICOMPX(X)="X"
SET DICOMPX(X,U)=DI_U_DL
WRITE ?2,"NOTE: '"_X_"' CAN BE USED TO REFER TO THE VALUE OF THE",!?2,DOLD_" FIELD BEFORE ITS CHANGE OR DELETION.",!
if $PIECE(^DD(DI,DL,0),U,2)["D"
SET DICOMPX(X,"DATE")=1
+2 QUIT
+3 ;
D01 SET V=DREF
SET X=$LENGTH(V)-1
FOR %=X:-1
IF "(,"[$EXTRACT(V,%)
SET DHI=$EXTRACT(V,%+1,X)
IF DHI'?1N1")"
SET V=$EXTRACT(V,1,%)
SET X=0
QUIT
DQ SET X=$FIND(V,"""",X)
IF X>0
SET V=$EXTRACT(V,1,X-1)_""""_$EXTRACT(V,X,999)
SET X=X+2
GOTO DQ
+1 SET X="I "_DHI_">0 N DIK S DIK(0)=DA,"
SET V="DIK="""_V_""","
SET DHI="DA="_DHI_" D ^DIK"
SET DTAG="S DA=DIK(0)"
+2 FOR %=1:1:N
SET X=X_"DIK("_%_")=DA("_%_"),"
SET DTAG=DTAG_",DA("_%_")=DIK("_%_")"
+3 FOR %=1:1:A#100
SET DHI="DA("_%_")=DIV("_(A#100-%)_"),"_DHI
+4 SET X=X_V_DHI
SET ^UTILITY("DICE",$JOB,"DIK")="DELETE"
GOTO F^DICE4
+5 ;
GET ;
+1 WRITE !," WHENEVER THE '"_DOLD_"' FIELD IS "_$PIECE("ENTERED OR CHANGED^CHANGED OR DELETED",U,DIK)
+2 READ ": ",X:DTIME
if '$TEST
SET X=U
SET Y=X
IF X=""
SET Y="NO EFFECT"
SET ^UTILITY("DICE",$JOB,DIK)="Q"
WRITE " ",Y
IF DIK=2
IF ^UTILITY("DICE",$JOB,1)="Q"
WRITE $CHAR(7),"??"
SET X=U
+3 SET ^UTILITY("DICE",$JOB,$PIECE("CREA^DELE",U,DIK)_"TE VALUE")=Y