AnsweredAssumed Answered

I am trying to concatenate values from repeated element per qualifier.

Question asked by gouthamr388096 on Sep 17, 2018
Latest reply on Sep 17, 2018 by Lee Sobotkin

I have an XML that looks something like below. What I am trying to do is for each subject qualifier (for example AAI), concatinate all tred_free.text element values. So for the below XML I want the output as (see second XML below)

 

<trsd_transport.service.requirements>
<trcd_contract.and.carriage.condition>
<tred_contract.and.carriage.condition.code>30</tred_contract.and.carriage.condition.code>
</trcd_contract.and.carriage.condition>
</trsd_transport.service.requirements>
<trsd_free.text>
<tred_text.subject.qualifier>AAI</tred_text.subject.qualifier>
<trcd_text.literal>
<tred_free.text>*** VGM *** IN LINE WITH SOLAS REGULATIONS IT IS A MANDATORY REQUIR</tred_free.text>
<tred_free.text>ALL DATES/TIMES ARE BEST REASONABLE ESTIMATES AND MAY CHM GER</tred_free.text>
</trcd_text.literal>

</trsd_free.text>

 

<trsd_free.text>
<tred_text.subject.qualifier>AAK</tred_text.subject.qualifier>
<trcd_text.literal>
<tred_free.text>*** BBCCCVVv WITH SOLAS REGULATIONS IT IS A MANDATORY REQUIR</tred_free.text>
<tred_free.text>KKKTTTCCCREASONABLE ESTIMATES AND MAY CHM GER</tred_free.text>
</trcd_text.literal>

</trsd_free.text>

 

**************SECOND XML***************** This how the output should be. Note the NoteText field below. It concatinates all occurance of text for given qualifier.

 

<NoteCollection >
      <Note>
            <Description>XXX</Description>
            <IsCustomDescription>false</IsCustomDescription>
            <NoteText>*** VGM *** IN LINE WITH SOLAS REGULATIONS IT IS A MANDATORY REQUIR ALL                DATES/TIMES       ARE BEST REASONABLE ESTIMATES AND MAY CHM GER </NoteText>
            <NoteContext>
            <Code>AAA</Code>
      </Note>

      <Note>
            <Description>Acceptance Terms Additional</Description>
            <IsCustomDescription>false</IsCustomDescription>
            <NoteText>*** BBCCCVVv WITH SOLAS REGULATIONS IT IS A MANDATORY             REQUIR KKKTTTCCCREASONABLE ESTIMATES AND MAY CHM GER</NoteText>
            <NoteContext>
            <Code>AAA</Code>
      </Note>
</NoteCollection>

Outcomes