Topic
  • 3 replies
  • Latest Post - ‏2012-10-23T11:16:35Z by ChB
JasonJava
JasonJava
19 Posts

Pinned topic How to combine XML output ?

‏2012-09-30T03:24:42Z |
I have a sample HL7 format file like the following.

OBX|1|TX|T084^URN SPECIFIC GRAVITY||HIGH||1.003-1.035||||F
OBX|2|TX|T084^URN SPECIFIC GRAVITY||1.038||1.003-1.035||||F
OBX|3|TX|T086^SOMETHING ESLE||0|HPF|0-9||||F
OBX|4|TX|T087^NOTHING||0|HPF|0-9||||F

My output for T084 is as follows

<OBX>
<OBX_3_Ltt_Cd>T084</OBX_3_Ltt_Cd>
<OBX_5_1_Lbr_No></OBX_5_1_Lbr_No>
<OBX_5_2_Lbr_Tx>HIGH</OBX_5_2_Lbr_Tx>
<OBX_6_Lbr_Unt_Tx></OBX_6_Lbr_Unt_Tx>
<OBX_7_Lbr_Rng_Tx>1.003-1.035</OBX_7_Lbr_Rng_Tx>
</OBX>
<OBX>
<OBX_3_Ltt_Cd>T084</OBX_3_Ltt_Cd>
<OBX_5_1_Lbr_No>1.038</OBX_5_1_Lbr_No>
<OBX_5_2_Lbr_Tx></OBX_5_2_Lbr_Tx>
<OBX_6_Lbr_Unt_Tx />
<OBX_7_Lbr_Rng_Tx>1.003-1.035</OBX_7_Lbr_Rng_Tx>
</OBX>

However, the output should be something like the following. I am not sure how to read multiple lines and only generate one set of output with the same key (ie. T084 in this case).
<OBX>
<OBX_3_Ltt_Cd>T084</OBX_3_Ltt_Cd>
<OBX_5_1_Lbr_No>1.038</OBX_5_1_Lbr_No>
<OBX_5_2_Lbr_Tx>HIGH</OBX_5_2_Lbr_Tx>
<OBX_6_Lbr_Unt_Tx />
<OBX_7_Lbr_Rng_Tx>1.003-1.035</OBX_7_Lbr_Rng_Tx>
</OBX>

Thanks in advance.
Updated on 2012-10-23T11:16:35Z at 2012-10-23T11:16:35Z by ChB
  • Muk1234
    Muk1234
    22 Posts

    Re: How to combine XML output ?

    ‏2012-10-05T07:31:54Z  
    Hello JasonJava

    I wanna do similar kind of thing. If you have got the solution please post it. In your case I think you can use functional map at the lowest level. Please go through my thread "How to map multiple functional maps to an output field". May be we are stuck at the same thing.

    Regards
    Muks1234
  • JasonJava
    JasonJava
    19 Posts

    Re: How to combine XML output ?

    ‏2012-10-18T19:37:46Z  
    • Muk1234
    • ‏2012-10-05T07:31:54Z
    Hello JasonJava

    I wanna do similar kind of thing. If you have got the solution please post it. In your case I think you can use functional map at the lowest level. Please go through my thread "How to map multiple functional maps to an output field". May be we are stuck at the same thing.

    Regards
    Muks1234
    In my case, eventually, I had to use a XSL (non-WTX) to do another transformation.
  • ChB
    ChB
    26 Posts

    Re: How to combine XML output ?

    ‏2012-10-23T11:16:35Z  
    Don't merge the XML output! Prepare the input!

    You have to do it in two steps:

    1st outputcard (SINK): Extract the Key-Values you want to merge. Keywords: EXTRACT/UNIQUE

    2nd outputcard: You need to create a functional map, 1st parameter: keyvalue, 2nd parameter: the whole input message. Within the functional map do a lookup on the values you want to merge. Keywords: LOOKUP/EITHER. Be aware: only one lookup per input in one rule.

    Best regards

    Chris