XHDPARAM ; SLC/JER - Configurator Server Calls ; 25 Jul 2003 9:42 AM
;;1.0;HEALTHEVET DESKTOP;;Jul 15, 2003
PUT(ERR,KEY,VALUE) ; Calls PUT^XPAR to set param value
N ENT,PAR,INST,PUTVAL,X,VDTYPE
S X="ONERROR^XHDPARAM",@^%ZOSF("TRAP")
S ENT=$S(+$P(KEY,U,2):$P(KEY,U,2),1:DUZ_";VA(200,"),PAR=$P(KEY,U,3)
S VDTYPE=$P($G(^XTV(8989.51,PAR,1)),U)
S INST=$P(KEY,U,4)
S:INST']"" INST=1
I $S(VDTYPE="W":1,$$COUNT(.VALUE)>1:1,1:0) D SETWPVAL(.VALUE,.PUTVAL) S PUTVAL=$P(KEY,U) I 1
E S PUTVAL=$$XFORM(VALUE(1),VDTYPE)
S ^XTMP("XHDPARAM",$J,KEY,"ENT")=ENT,^("PAR")=PAR,^("INST")=INST,^("PUTVAL")=PUTVAL
D EN^XPAR(ENT,PAR,INST,.PUTVAL,.ERR)
S ^XTMP("XHDPARAM",$J,KEY,"ERR")=ERR
Q
COUNT(VALUE) ; Count number of lines in VALUE
N XHDI,COUNT S (COUNT,XHDI)=0
F S XHDI=$O(VALUE(XHDI)) Q:+XHDI'>0 S COUNT=COUNT+1
Q COUNT
SETWPVAL(INVALUE,OUTVALUE) ; Sets 0-nodes for WordProcessing value
N XHDI,VAL S XHDI=0
F S XHDI=$O(INVALUE(XHDI)) Q:+XHDI'>0 S OUTVALUE(XHDI,0)=INVALUE(XHDI) K INVALUE(XHDI)
Q
ONERROR ; Trap errors
S ERR="1^"_$TR($$EC^%ZOSV,"^","~")
D ^%ZTER
Q
XFORM(VAL,VDTYPE) ; Transform values for select data types
N XHDY S XHDY=VAL
I VDTYPE="D" S XHDY=$$HL7TFM^XLFDT(VAL) G XFORMX
I VDTYPE="Y" S XHDY=$S(VAL="true":"YES",VAL="false":"NO",1:VAL)
XFORMX Q XHDY
XHDPARAM ; SLC/JER - Configurator Server Calls ; 25 Jul 2003 9:42 AM
+1 ;;1.0;HEALTHEVET DESKTOP;;Jul 15, 2003
PUT(ERR,KEY,VALUE) ; Calls PUT^XPAR to set param value
+1 NEW ENT,PAR,INST,PUTVAL,X,VDTYPE
+2 SET X="ONERROR^XHDPARAM"
SET @^%ZOSF("TRAP")
+3 SET ENT=$SELECT(+$PIECE(KEY,U,2):$PIECE(KEY,U,2),1:DUZ_";VA(200,")
SET PAR=$PIECE(KEY,U,3)
+4 SET VDTYPE=$PIECE($GET(^XTV(8989.51,PAR,1)),U)
+5 SET INST=$PIECE(KEY,U,4)
+6 IF INST']""
SET INST=1
+7 IF $SELECT(VDTYPE="W":1,$$COUNT(.VALUE)>1:1,1:0)
DO SETWPVAL(.VALUE,.PUTVAL)
SET PUTVAL=$PIECE(KEY,U)
IF 1
+8 IF '$TEST
SET PUTVAL=$$XFORM(VALUE(1),VDTYPE)
+9 SET ^XTMP("XHDPARAM",$JOB,KEY,"ENT")=ENT
SET ^("PAR")=PAR
SET ^("INST")=INST
SET ^("PUTVAL")=PUTVAL
+10 DO EN^XPAR(ENT,PAR,INST,.PUTVAL,.ERR)
+11 SET ^XTMP("XHDPARAM",$JOB,KEY,"ERR")=ERR
+12 QUIT
COUNT(VALUE) ; Count number of lines in VALUE
+1 NEW XHDI,COUNT
SET (COUNT,XHDI)=0
+2 FOR
SET XHDI=$ORDER(VALUE(XHDI))
IF +XHDI'>0
QUIT
SET COUNT=COUNT+1
+3 QUIT COUNT
SETWPVAL(INVALUE,OUTVALUE) ; Sets 0-nodes for WordProcessing value
+1 NEW XHDI,VAL
SET XHDI=0
+2 FOR
SET XHDI=$ORDER(INVALUE(XHDI))
IF +XHDI'>0
QUIT
SET OUTVALUE(XHDI,0)=INVALUE(XHDI)
KILL INVALUE(XHDI)
+3 QUIT
ONERROR ; Trap errors
+1 SET ERR="1^"_$TRANSLATE($$EC^%ZOSV,"^","~")
+2 DO ^%ZTER
+3 QUIT
XFORM(VAL,VDTYPE) ; Transform values for select data types
+1 NEW XHDY
SET XHDY=VAL
+2 IF VDTYPE="D"
SET XHDY=$$HL7TFM^XLFDT(VAL)
GOTO XFORMX
+3 IF VDTYPE="Y"
SET XHDY=$SELECT(VAL="true":"YES",VAL="false":"NO",1:VAL)
XFORMX QUIT XHDY