54 lines
2.1 KiB
Mathematica
54 lines
2.1 KiB
Mathematica
DIQ1 ;SFISC/XAK-INQUIRY WITH COMPUTED FIELDS ;6:09 AM 24 Nov 2003
|
|
;;22.0;VA FileMan;**19,64,76,133**;Mar 30, 1999
|
|
;Per VHA Directive 10-93-142, this routine should not be modified.
|
|
;
|
|
A S DIDQ=DD S:'$D(DICMX) DICMX="W !,O,"": "",X"
|
|
N W,DD,D,Z
|
|
F W=0:0 S W=$O(^DD(DIDQ,W)) Q:W'>0 I $D(^(W,0))#2 S Z=^(0),C=$P(Z,U,2),O=$P(Z,U)_" (c)" I C["C" X $P(Z,U,5,99) I X]"" D Q:'S
|
|
.N Y S Y=X
|
|
.I C["p",Y S Y=$$CP(C,Y)
|
|
.E I C["D" X ^DD("DD")
|
|
.D W2^DIQ
|
|
K DIDQ,DICMX Q
|
|
;
|
|
CP(C,X) ;
|
|
S:C["p" C=+$P(C,"p",2) I C,$D(^DIC(C,0,"GL")),$D(@(^("GL")_"0)")),$D(^(X,0)) S X=$$EXTERNAL^DIDU(C,.01,"",$P(^(0),U))
|
|
Q X
|
|
;
|
|
EN ;
|
|
Q:'$D(DIC)!($D(DA)[0)!($D(DR)[0) S DIL=0,(DA(0),D0)=DA,DIQ0=""
|
|
I $D(DIQ)#2 G Q:DIQ["^"!($E(DIQ,1,2)="DI") S:DIQ'["(" DIQ=DIQ_"("
|
|
S:'$D(DIQ(0)) DIQ(0)="",DIQ0="DIQ(0),"
|
|
I $D(DIQ)[0 S DIQ="^UTILITY(""DIQ1"",$J,",DIQ0="DIQ,"
|
|
S DIQ0=DIQ0_"DIQ0"
|
|
I DIC S DIC=$S($D(^DIC(DIC,0,"GL")):^("GL"),1:"") G:DIC="" Q
|
|
L G Q:'$D(@(DIC_"0)")) S DI=+$P(^(0),U,2) G Q:'$D(^(DA,0))
|
|
N DII F DII=1:1 S DIQ1=$P(DR,";",DII) Q:DIQ1="" D C:DIQ1[":",F:DIQ1>0
|
|
Q Q:DIL K %,I,J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