source: FOIAVistA/trunk/r/VA_FILEMAN-ARJT-DI-DD-DM-DT-%DT-%RCR/DICE2.m@ 752

Last change on this file since 752 was 628, checked in by George Lilly, 15 years ago

initial load of FOIAVistA 6/30/08 version

File size: 2.5 KB
Line 
1DICE2 ;SFISC/GFT-TRIGGER LOGIC ;09:41 AM 10 Jul 1999
2 ;;22.0;VA FileMan;**6**;Mar 30, 1999
3 ;Per VHA Directive 10-93-142, this routine should not be modified.
4 Q:$D(DTOUT) W !!!,"---",$P("SET^KILL",U,DIK)," LOGIC---" S DA="^DD("_DI_","_DL_",1,"_DQ_","_(DIK+3)
5C 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
6 W !!,"IN ANSWERING THE FOLLOWING QUESTION, '"_DNEW_"'",!?2,"CAN BE USED TO REFER TO THE EXISTING TRIGGERED FIELD VALUE.",!
7 S DICOMP="?",DICOMPX="",%=DIN S:DIK=1 DICOMPX(1,DI,DL)="DIV"
8 D OLD W "PLEASE ENTER AN EXPRESSION WHICH WILL BECOME THE VALUE OF THE",! S %F=DENEW D WR^DIDH
9 D GET Q:U[X I X="""@""" K X G DICE2^DIQQ
10 I X="@" S X="S X="""""
11 E D ^DICOMP G DICE2^DIQQ:'$D(X) F %=9.2:.1 Q:'$D(X(%)) S ^UTILITY("DICE",$J,DIK+3*10+%)=X(%)
12 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
13 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!"
14 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'!"
15 I Y["B" W $C(7),!,"WARNING--THIS TRUTH-VALUED EXPRESSION WILL PRODUCE ONLY VALUES OF '0' OR '1'"
16 I %'["D",Y["D" W $C(7),!,"WARNING -- THIS MAY PRODUCE A 'DATE', AND IT SHOULDN'T!"
17 D ^DICE3 G ^DICE4:X'=U
18Q Q
19 ;
20OLD ;
21 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
22 Q
23 ;
24D01 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
25DQ S X=$F(V,"""",X) I X>0 S V=$E(V,1,X-1)_""""_$E(V,X,999),X=X+2 G DQ
26 S X="I "_DHI_">0 N DIK S DIK(0)=DA,",V="DIK="""_V_""",",DHI="DA="_DHI_" D ^DIK",DTAG="S DA=DIK(0)"
27 F %=1:1:N S X=X_"DIK("_%_")=DA("_%_"),",DTAG=DTAG_",DA("_%_")=DIK("_%_")"
28 F %=1:1:A#100 S DHI="DA("_%_")=DIV("_(A#100-%)_"),"_DHI
29 S X=X_V_DHI,^UTILITY("DICE",$J,"DIK")="DELETE" G F^DICE4
30 ;
31GET ;
32 W !," WHENEVER THE '"_DOLD_"' FIELD IS "_$P("ENTERED OR CHANGED^CHANGED OR DELETED",U,DIK)
33 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
34 S ^UTILITY("DICE",$J,$P("CREA^DELE",U,DIK)_"TE VALUE")=Y
Note: See TracBrowser for help on using the repository browser.