Map individual fields to repeating xml element

Clovertech Forums Cloverleaf Map individual fields to repeating xml element

  • Creator
    Topic
  • #119526
    Ken Smith
    Participant

      I need to map individual feeds from an HL7 message, e.g., first name, surname, DOB, etc. to a repeating xml element comprised of name:value pairs, e.g.,

      <name>fname</name>

      <value>Abe</value>

      In the xlate, in the Destination, I have something like: dataitem(0).name.#text

      is there a way to use and increment a variable so I don’t have to hard code the element number, e.g., dataitem(@int).key.#text

      I’ve tried exactly that and the xlate vents its fury.

      I thought about setting an iterator on the destination, so as to use a %s1 counter, but this doesn’t seem logically possible, as the source is one field, then another field, then another field. There’s not way to loop through distinct source values in the destination iterator.

    Viewing 1 reply thread
    • Author
      Replies
      • #119527
        Keith McLeod
        Participant

          Have you tried your own variable like the iterate variables.  I use this often in iterates.

          Copy =0 –> $%f9 before the iterate and then use

          math add $%f9 =1 –> $%f9 to increment the variable at the end of your condition or iterate.

          In your expression for the outbound, use only the %f9 portion of the variable.  The preceding $ is required in order to manipulate the variable on both input and output side.

           

          Hope this helps…

          • #119529
            Ken Smith
            Participant

              Thanks, that works exactly as described. I had a faint recollection of being able to do what you describe but couldn’t find the right thread to grasp. Thanks very much.

          • #119528
            Keith McLeod
            Participant

              If there is no filtering you could possibly use the %s1 and let the iterate provide the incrementing.  I think you can only iterate on the input side anyway.

          Viewing 1 reply thread
          • You must be logged in to reply to this topic.