source: WorldVistAEHR/trunk/r/HEALTHEVET_DESKTOP-XHD/XHDPDEF.m@ 862

Last change on this file since 862 was 613, checked in by George Lilly, 15 years ago

initial load of WorldVistAEHR

File size: 5.4 KB
Line 
1XHDPDEF ; SLC/JER - Parameter Definition Calls ; 25 Jul 2003 9:42 AM
2 ;;1.0;HEALTHEVET DESKTOP;;Jul 15, 2003
3LIST(XHDY,FROM,DIR,SIZE) ; Get next SIZE definitions in DIR direction
4 N XHDI,XHDCNT S XHDCNT=0,SIZE=$G(SIZE,44),DIR=$G(DIR,"+1")
5 S XHDI=FROM ;$S(FROM="":FROM,1:$O(^XTV(8989.51,"B",FROM),-DIR))
6 F S XHDI=$O(^XTV(8989.51,"B",XHDI),DIR) Q:XHDI']""!(XHDCNT'<SIZE) D
7 . N XHDDA S XHDDA=0
8 . F S XHDDA=$O(^XTV(8989.51,"B",XHDI,XHDDA)) Q:+XHDDA'>0!(XHDCNT'<SIZE) D
9 . . S XHDCNT=XHDCNT+1,XHDY(XHDCNT)=XHDDA_U_$P($G(^XTV(8989.51,+XHDDA,0)),U,1,2)_U_$$ENTSTR(XHDDA)
10 Q
11GETALL(XHDY) ; Gets all parameter definitions in ^TMP("XHDPDEF",$J)
12 N XHDI,XHDCNT S XHDI="",XHDCNT=0 S XHDY=$NA(^TMP("XHDPDEF",$J))
13 F S XHDI=$O(^XTV(8989.51,"B",XHDI)) Q:XHDI']"" D
14 . N XHDDA S XHDDA=0
15 . F S XHDDA=$O(^XTV(8989.51,"B",XHDI,XHDDA)) Q:+XHDDA'>0 D
16 . . S XHDCNT=XHDCNT+1
17 . . S @XHDY@(XHDCNT)=XHDDA_U_$P($G(^XTV(8989.51,XHDDA,0)),U,1,2)_U_$$ENTSTR(XHDDA)
18 Q
19ENTSTR(XHDDA) ; Get applicable entities
20 N XHDI,ENTSTR,ENTCNT S ENTSTR="",(ENTCNT,XHDI)=0
21 F S XHDI=$O(^XTV(8989.51,XHDDA,30,XHDI)) Q:XHDI'>0 D
22 . N ENT0 S ENT0=$G(^XTV(8989.51,XHDDA,30,XHDI,0)) Q:+ENT0'>0
23 . S ENTSTR=ENTSTR_$S(ENTCNT=0:"",1:";")_+ENT0_"|"_$$ENTFILE($P(ENT0,U,2))
24 . S ENTCNT=ENTCNT+1
25 Q ENTSTR
26ENTFILE(ENTDA) ; Resolve entity name
27 Q $P($G(^XTV(8989.518,ENTDA,0)),U)
28GETXML(XHDY,XHDDA) ; Control Branching
29 N XHDI,XHDJ,X S X="ONERROR^XHDPDEF",@^%ZOSF("TRAP")
30 S XHDI=0,XHDJ=""
31 S XHDY=$NA(^TMP("XHDPDEF",$J)) K @XHDY
32 S XHDI=XHDI+1,@XHDY@("XMLDOC",XHDI)="<?xml version=""1.0"" encoding=""UTF-8""?>"
33 S XHDI=XHDI+1,@XHDY@("XMLDOC",XHDI)="<getParameterDefinitionsCallResult>"
34 S XHDI=XHDI+1,@XHDY@("XMLDOC",XHDI)="<parameterDefinitionList>"
35 I +$G(XHDDA) D
36 . D GETDEF(XHDY,XHDDA,.XHDI)
37 E D
38 . F S XHDJ=$O(^XTV(8989.51,"B",XHDJ)) Q:XHDJ="" D
39 . . N XHDDA S XHDDA=0
40 . . F S XHDDA=$O(^XTV(8989.51,"B",XHDJ,XHDDA)) Q:+XHDDA'>0 D
41 . . . D GETDEF(XHDY,XHDDA,.XHDI)
42 S XHDI=XHDI+1,@XHDY@("XMLDOC",XHDI)="</parameterDefinitionList>"
43 S XHDI=XHDI+1,@XHDY@("XMLDOC",XHDI)="</getParameterDefinitionsCallResult>"
44 S XHDY=$NA(^TMP("XHDPDEF",$J,"XMLDOC"))
45 M ^XTMP("XHDPDEF",$J,"XMLDOC")=@XHDY
46 Q
47FLDS() ; Get field string
48 Q ".01:8"
49GETDEF(XHDY,XHDDA,XHDI) ; Loads Top-level Fields
50 N XHDF,XHDDI S XHDF=0
51 S XHDI=XHDI+1,@XHDY@("XMLDOC",XHDI)="<parameterDefinition>"
52 S XHDI=XHDI+1,@XHDY@("XMLDOC",XHDI)="<id>"_XHDDA_"</id>"
53 D GETS^DIQ(8989.51,XHDDA_",",$$FLDS,"E",XHDY)
54 F S XHDF=$O(@XHDY@(8989.51,XHDDA_",",XHDF)) Q:XHDF'>0 D
55 . N TAG,VAL
56 . S TAG=$TR($$FLDNAME(XHDF,8989.51)," /","")
57 . S VAL=$G(@XHDY@(8989.51,XHDDA_",",XHDF,"E"))
58 . I $S(XHDF=.03:1,XHDF=.06:1,1:0) S VAL=$S(VAL="Yes":"true",1:"false")
59 . S XHDI=XHDI+1,@XHDY@("XMLDOC",XHDI)="<"_TAG_">"_$$ESCAPE^XHDLXM(VAL)_"</"_TAG_">"
60 K @XHDY@(8989.51)
61 ;** get description **
62 S XHDDI=0
63 S XHDI=XHDI+1,@XHDY@("XMLDOC",XHDI)="<description>"
64 S XHDI=XHDI+1,@XHDY@("XMLDOC",XHDI)="<![CDATA["
65 F S XHDDI=$O(^XTV(8989.51,XHDDA,20,XHDDI)) Q:+XHDDI'>0 D
66 . S XHDI=XHDI+1,@XHDY@("XMLDOC",XHDI)=$G(^XTV(8989.51,XHDDA,20,XHDDI,0))
67 S XHDI=XHDI+1,@XHDY@("XMLDOC",XHDI)="]]>"
68 S XHDI=XHDI+1,@XHDY@("XMLDOC",XHDI)="</description>"
69 ;** get entities **
70 D GETENTS(XHDY,XHDDA,.XHDI)
71 ;** get keywords **
72 D KEYWORDS(XHDY,XHDDA,.XHDI)
73 S XHDI=XHDI+1,@XHDY@("XMLDOC",XHDI)="</parameterDefinition>"
74 Q
75FLDNAME(XHDFN,FILENUM) ; Resolve field names
76 Q $$MIXED($P($G(^DD(FILENUM,XHDFN,0)),U))
77MIXED(X) ; Return Mixed Case X
78 N XHDI,WORD,TMP
79 S TMP="" F XHDI=1:1:$L(X," ") S WORD=$$LOW^XLFSTR($P(X," ",XHDI)),$E(WORD)=$S(XHDI=1:$E(WORD),1:$$UP^XLFSTR($E(WORD))),TMP=$S(TMP="":WORD,1:TMP_WORD)
80 Q TMP
81GETENTS(XHDY,XHDDA,XHDI) ; Get allowable entities
82 N XHDSDA S XHDSDA=0,FLDS=".01:.02"
83 S XHDI=XHDI+1,@XHDY@("XMLDOC",XHDI)="<entities>"
84 F S XHDSDA=$O(^XTV(8989.51,XHDDA,30,XHDSDA)) Q:+XHDSDA'>0 D
85 . S XHDI=XHDI+1,@XHDY@("XMLDOC",XHDI)="<entity>"
86 . D GETS^DIQ(8989.513,XHDSDA_","_XHDDA_",",FLDS,"E",XHDY)
87 . F S XHDF=$O(@XHDY@(8989.513,XHDSDA_","_XHDDA_",",XHDF)) Q:XHDF'>0 D
88 . . N TAG,VAL
89 . . S TAG=$TR($$FLDNAME(XHDF,8989.513)," /","")
90 . . S VAL=$G(@XHDY@(8989.513,XHDSDA_","_XHDDA_",",XHDF,"E"))
91 . . S XHDI=XHDI+1,@XHDY@("XMLDOC",XHDI)="<"_TAG_">"_$$ESCAPE^XHDLXM(VAL)_"</"_TAG_">"
92 . K @XHDY@(8989.513)
93 . S XHDI=XHDI+1,@XHDY@("XMLDOC",XHDI)="</entity>"
94 S XHDI=XHDI+1,@XHDY@("XMLDOC",XHDI)="</entities>"
95 Q
96KEYWORDS(XHDY,XHDDA,XHDI) ; Get Keywords
97 N XHDSDA S XHDSDA=0,FLDS=".01"
98 S XHDI=XHDI+1,@XHDY@("XMLDOC",XHDI)="<keywords>"
99 F S XHDSDA=$O(^XTV(8989.51,XHDDA,4,XHDSDA)) Q:+XHDSDA'>0 D
100 . D GETS^DIQ(8989.514,XHDSDA_","_XHDDA_",",FLDS,"E",XHDY)
101 . F S XHDF=$O(@XHDY@(8989.514,XHDSDA_","_XHDDA_",",XHDF)) Q:XHDF'>0 D
102 . . N TAG,VAL
103 . . S TAG=$TR($$FLDNAME(XHDF,8989.514)," /","")
104 . . S VAL=$G(@XHDY@(8989.514,XHDSDA_","_XHDDA_",",XHDF,"E"))
105 . . S XHDI=XHDI+1,@XHDY@("XMLDOC",XHDI)="<"_TAG_">"_$$ESCAPE^XHDLXM(VAL)_"</"_TAG_">"
106 . K @XHDY@(8989.514)
107 S XHDI=XHDI+1,@XHDY@("XMLDOC",XHDI)="</keywords>"
108 Q
109ONERROR ; Trap errors
110 N XHDCI S XHDCI=4
111 ; remove remnant of DIQ1 call result
112 K @XHDCY@(8989.51),@XHDCY@(8989.513)
113 ; remove partial configTree node
114 F S XHDCI=$O(@XHDCY@("XMLDOC",XHDCI)) Q:+XHDCI'>0 K @XHDCY@("XMLDOC",XHDCI)
115 ; append error node to call result
116 S XHDCI=4
117 S XHDCI=XHDCI+1,@XHDCY@("XMLDOC",XHDCI)="<error>"
118 S XHDCI=XHDCI+1,@XHDCY@("XMLDOC",XHDCI)="<![CDATA["_$$EC^%ZOSV_"]]>"
119 S XHDCI=XHDCI+1,@XHDCY@("XMLDOC",XHDCI)="</error>"
120 S XHDCI=XHDCI+1,@XHDCY@("XMLDOC",XHDCI)="</getConfigurationCallResult>"
121 S XHDCY=$NA(^TMP("XHDPTREE",$J,"XMLDOC"))
122 D ^%ZTER
123 Q
Note: See TracBrowser for help on using the repository browser.