Values of XML duplicated in case of missing tag in XLATE

Clovertech Forums Read Only Archives Cloverleaf Cloverleaf Values of XML duplicated in case of missing tag in XLATE

  • Creator
    Topic
  • #55687
    Roberto Costa Filho
    Participant

      Hi clovertechs experts,

      I have a problem with the iterate function of XLATE.

      I have to translate one XML to another using XLATE.

      I am using the iterate function and gererating two xml. Below are my simplified samples



      [code]

    Viewing 5 reply threads
    • Author
      Replies
      • #86168
        Jim Kosloskey
        Participant

          My guess would be the position of the ITERATE variable in the address path of the COPY(s) does not match the position specified in the basis for the repetition.

          So the ITERATE does walk over the repetitions but the COPY(s) point to only the first repetition.

          I would need more information to be more help.

          email: jim.kosloskey@jim-kosloskey.com 29+ years Cloverleaf, 59 years IT - old fart.

        • #86169
          Robert Kersemakers
          Participant

            As procedure B doesn’t have an observation, the translation will not find the observation and totally skip the COPY statement as there is no input. So in the second iteration the observation is not touched and the output remains ” Some Observation”.

            Try putting a

            Code:

            COPY @null -> order_element.newobservation.#text


            before you fill newobservation with the value. This should help.

            Zuyderland Medisch Centrum; Heerlen/Sittard; The Netherlands

          • #86170
            Jim Kosloskey
            Participant

              Unless XML is different doesn’t the Xlate treat non existent fields as null and thus complete the copy using null?

              email: jim.kosloskey@jim-kosloskey.com 29+ years Cloverleaf, 59 years IT - old fart.

            • #86171
              Robert Kersemakers
              Participant

                XML translating is different from HL7 translations and I have seen this behaviour in our translations before.

                You will get a @null result if the inbound XML is

                Code:


                  1
                   
                     
                        Procedure A
                        Some Observation
                   
                   
                      Procedure B
                     
                   
                 


                or even

                Code:


                  1
                   
                     
                        Procedure A
                        Some Observation
                   
                   
                      Procedure B
                     
                   
                 

                But if the ‘tag’ is not there, the Xlate COPY will not be performed. I guess because the field is not there, the translation can’t even perform the COPY.

                Can’t test it quickly right now though.

                Zuyderland Medisch Centrum; Heerlen/Sittard; The Netherlands

              • #86172
                Jim Kosloskey
                Participant

                  Good to know. I love learning something new!!

                  email: jim.kosloskey@jim-kosloskey.com 29+ years Cloverleaf, 59 years IT - old fart.

                • #86173
                  Roberto Costa Filho
                  Participant

                    The two examples that you mentioned worked as expected. And I will put this @null before each copy statement.

                    Thank you Robert Kersemakers

                    it works.

                Viewing 5 reply threads
                • The forum ‘Cloverleaf’ is closed to new topics and replies.