ORX4 ; SLC/MKB - OE/RR Orders file extract utilities ;9/30/97  14:58
 ;;3.0;ORDER ENTRY/RESULTS REPORTING;;Dec 17, 1997
VALUE(IFN,ID,INST,FORMAT) ; -- Returns value of prompt by ID
 I '$G(IFN)!('$D(^OR(100,+$G(IFN),0)))!($G(ID)="") Q ""
 N I,Y S I=0,Y="" S:'$G(INST) INST=1
 F  S I=$O(^OR(100,+IFN,4.5,"ID",ID,I)) Q:I'>0  I $P($G(^OR(100,+IFN,4.5,+I,0)),U,3)=INST S PRMT=+$P(^(0),U,2),Y=$G(^(1)) Q
 I $L(Y),$G(PRMT),$G(FORMAT)="E" D  ; get external form of Y
 . N ORDIALOG S ORDIALOG(PRMT,0)=$G(^ORD(101.41,PRMT,1))
 . S ORDIALOG(PRMT,1)=Y,Y=$$EXT^ORCD(PRMT,1)
 Q Y
 
--- Routine Detail   --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HORX4   576     printed  Sep 23, 2025@20:14:13                                                                                                                                                                                                         Page 2
ORX4      ; SLC/MKB - OE/RR Orders file extract utilities ;9/30/97  14:58
 +1       ;;3.0;ORDER ENTRY/RESULTS REPORTING;;Dec 17, 1997
VALUE(IFN,ID,INST,FORMAT) ; -- Returns value of prompt by ID
 +1        IF '$GET(IFN)!('$DATA(^OR(100,+$GET(IFN),0)))!($GET(ID)="")
               QUIT ""
 +2        NEW I,Y
           SET I=0
           SET Y=""
           if '$GET(INST)
               SET INST=1
 +3        FOR 
               SET I=$ORDER(^OR(100,+IFN,4.5,"ID",ID,I))
               if I'>0
                   QUIT 
               IF $PIECE($GET(^OR(100,+IFN,4.5,+I,0)),U,3)=INST
                   SET PRMT=+$PIECE(^(0),U,2)
                   SET Y=$GET(^(1))
                   QUIT 
 +4       ; get external form of Y
           IF $LENGTH(Y)
               IF $GET(PRMT)
                   IF $GET(FORMAT)="E"
                       Begin DoDot:1
 +5                        NEW ORDIALOG
                           SET ORDIALOG(PRMT,0)=$GET(^ORD(101.41,PRMT,1))
 +6                        SET ORDIALOG(PRMT,1)=Y
                           SET Y=$$EXT^ORCD(PRMT,1)
                       End DoDot:1
 +7        QUIT Y