VistA-WorldVistAEHR/r/HEALTHEVET_DESKTOP-XHD/XHDPARAM.m

33 lines
1.3 KiB
Mathematica

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