Home   Package List   Routine Alphabetical List   Global Alphabetical List   FileMan Files List   FileMan Sub-Files List   Package Component Lists   Package-Namespace Mapping  
Routine: DIQ1

DIQ1.m

Go to the documentation of this file.
DIQ1 ;SFISC/XAK-INQUIRY WITH COMPUTED FIELDS ;26JAN2004
 ;;22.2;VA FileMan;**14**;Jan 05, 2016;Build 8
 ;;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.
 ;
A N DIDQ,DICMX,DIQ1W,D,Z,DIQX
 S DIDQ=DD,DICMX="D LF^DIQ K:'S D I S W O,"": "",X S X="""",O=$J(X,$L(O))"
 N DD
 F DIQ1W=0:0 S DIQ1W=$O(^DD(DIDQ,DIQ1W)) Q:DIQ1W'>0  I $D(^(DIQ1W,0))#2 S Z=^(0),C=$P(Z,U,2) I C["C" S X="",O=$$LABEL^DIALOGZ(DIDQ,DIQ1W)_" (c)" X $P(Z,U,5,99) D:X]""&(C'["m")  Q:'S  ;**CCO/NI  LOOP THRU ALL FIELDS TO FIND COMPUTED
 .N Y,W S Y=X,W=DIQ1W
 .I C["p",Y S Y=$$CP(C,Y)
 .E  I C["D" X ^DD("DD")
 .D W2^DIQ
 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 ;
 N C,DI ;p14
 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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