update for eRx

This commit is contained in:
george 2009-10-06 21:41:09 +00:00
parent 9f8abd97f6
commit a6dd66d955
1 changed files with 8 additions and 4 deletions

View File

@ -56,8 +56,9 @@ PUSHA(ADEST,ASRC) ; PUSH ASRC ONTO ADEST, BOTH PASSED BY NAME
. D PUSH(ADEST,@ASRC@(ZGI)) ; PUSH ONE ELEMENT
Q
;
MKMDX(STK,RTN) ; MAKES A MUMPS INDEX FROM THE ARRAY STK
MKMDX(STK,RTN,INREDUX) ; MAKES A MUMPS INDEX FROM THE ARRAY STK
; RTN IS SET TO //FIRST/SECOND/THIRD FOR THREE ARRAY ELEMENTS
; REDUX IS A STRING TO REMOVE FROM THE RESULT
S RTN=""
N I
; W "STK= ",STK,!
@ -65,6 +66,7 @@ MKMDX(STK,RTN) ; MAKES A MUMPS INDEX FROM THE ARRAY STK
. S RTN="//"_@STK@(1) ; FIRST ELEMENT NEEDS NO SEMICOLON
. I @STK@(0)>1 D ; SUBSEQUENT ELEMENTS NEED A SEMICOLON
. . F I=2:1:@STK@(0) S RTN=RTN_"/"_@STK@(I)
I $G(INREDUX)'="" S RTN=$P(RTN,INREDUX,1)_$P(RTN,INREDUX,2)
Q
;
XNAME(ISTR) ; FUNCTION TO EXTRACT A NAME FROM AN XML FRAG
@ -199,7 +201,8 @@ ZXVAL(WHAT,VAL)
D PUSH(OUTXML,"<"_WHAT_">"_VAL_"</"_WHAT_">")
Q
;
INDEX(IZXML,VDX,NOINX,TEMPLATE) ; parse XML in IZXML and produce an XPATH index
INDEX(IZXML,VDX,NOINX,TEMPLATE,REDUX) ; parse XML in IZXML and produce
; an XPATH index; REDUX is a string to be removed from each xpath
; GPL 7/14/09 OPTIONALLY GENERATE AN XML TEMPLATE IF PASSED BY NAME
; TEMPLATE IS IDENTICAL TO THE PARSED XML LINE BY LINE
; EXCEPT THAT DATA VALUES ARE REPLACED WITH @@XPATH@@ FOR THE XPATH OF THE TAG
@ -212,6 +215,7 @@ INDEX(IZXML,VDX,NOINX,TEMPLATE) ; parse XML in IZXML and produce an XPATH index
; IF NOINX IS SET TO 1, NO INDEX WILL BE GENERATED, BUT THE VDX WILL BE
N I,LINE,FIRST,LAST,CUR,TMP,MDX,FOUND,CURVAL,DVDX,LCNT
N C0CSTK ; LEAVE OUT FOR DEBUGGING
I '$D(REDUX) S REDUX=""
I '$D(NOINX) S NOINX=0 ; IF NOT PASSED, GENERATE AN INDEX
N ZXML
I NOINX S ZXML=$NA(^TMP("C0CINDEX",$J)) ; TEMP PLACE FOR INDEX TO DISCARD
@ -243,7 +247,7 @@ INDEX(IZXML,VDX,NOINX,TEMPLATE) ; parse XML in IZXML and produce an XPATH index
. . . S CUR=$$XNAME(LINE) ; EXTRACT THE NAME
. . . S CUR=CUR_$G(LKASD(CUR,I)) ; HANDLE MULTIPLES
. . . D PUSH("C0CSTK",CUR) ; ADD TO THE STACK
. . . D MKMDX("C0CSTK",.MDX) ; GENERATE THE M INDEX
. . . D MKMDX("C0CSTK",.MDX,REDUX) ; GENERATE THE M INDEX
. . . ; W "MDX=",MDX,!
. . . I $D(@ZXML@(MDX)) D ; IN THE INDEX, IS A MULTIPLE
. . . . ;I '$D(ZDUP(MDX)) S ZDUP(MDX)=2
@ -392,7 +396,7 @@ BUILD(BLIST,BDEST) ; A COPY MACHINE THAT TAKE INSTRUCTIONS IN ARRAY BLIST
;
QUEUE(BLST,ARRAY,FIRST,LAST) ; ADD AN ENTRY TO A BLIST
;
I DEBUG W "QUEUEING ",BLST,!
I $G(DEBUG) W "QUEUEING ",BLST,!
D PUSH(BLST,ARRAY_";"_FIRST_";"_LAST)
Q
;