Page 1 of 1

XML output stage in 8.1 is unnecessarily grouping elements

Posted: Fri Sep 20, 2013 7:59 am
by parag.s.27
All,

I have a task where I have a complex set of repeating elements that are expected in the XML message going to MQ. I have been trying for 2 days now but I am seeing that for the complex repeating elements, the value is automatically getting deduped - grouoped even though the trigger column is something else.

For e.g.

The input records are: -

Code: Select all

Row1 PartyID: 123456789, prevRR: H, CuRR: H, Hierarchy: TK, H1party: L063969385, H1RR: S, H1Ind: N
Row2 PartyID: 26789456, prevRR: H, CuRR: H, Hierarchy: TK, H1party: L063969385, H1RR: S, H1Ind: N
Row2 PartyID: 987654321, prevRR: H, CuRR: H, Hierarchy: TK, H1party: L063969385, H1RR: S, H1Ind: N
My requirement is to get the output as: -
: -

Code: Select all

<ns1:OR>
	<ns1:ORParty TransactionType="C">
		<ns2:PartyIdTypeCode>PTY_ID</ns2:PartyIdTypeCode>
		<ns2:PartyId>123456789</ns2:PartyId>
	</ns1:ORParty>
	<ns1:ORPreviousRR>H</ns1:ORPreviousRR>
	<ns1:ORCurrentRR>H</ns1:ORCurrentRR>
	<ns1:ORHierarchy>TK</ns1:ORHierarchy>
</ns1:OR>
<ns1:OR>
	<ns1:ORParty TransactionType="C">
		<ns2:PartyIdTypeCode>PTY_ID</ns2:PartyIdTypeCode>
		<ns2:PartyId>26789456</ns2:PartyId>
	</ns1:ORParty>
	<ns1:ORPreviousRR>H</ns1:ORPreviousRR>
	<ns1:ORCurrentRR>H</ns1:ORCurrentRR>
	<ns1:ORHierarchy>TK</ns1:ORHierarchy>
</ns1:OR>
<ns1:OR>
	<ns1:ORParty TransactionType="C">
		<ns2:PartyIdTypeCode>PTY_ID</ns2:PartyIdTypeCode>
		<ns2:PartyId>987654321</ns2:PartyId>
	</ns1:ORParty>
	<ns1:ORPreviousRR>H</ns1:ORPreviousRR>
	<ns1:ORCurrentRR>H</ns1:ORCurrentRR>
	<ns1:ORHierarchy>TK</ns1:ORHierarchy>
</ns1:OR>
<ns1:H1>
	<ns1:H1Party TransactionType="C">
		<ns2:PartyIdTypeCode>ProfileId</ns2:PartyIdTypeCode>
		<ns2:PartyId>L063969385</ns2:PartyId>
	</ns1:H1Party>
	<ns1:H1ChannelCd>19</ns1:H1ChannelCd>
	<ns1:H1RR>S</ns1:H1RR>
	<ns1:H1ProfileDate>2015-06-12</ns1:H1ProfileDate>
	<ns1:H1Ind>N</ns1:H1Ind>
</ns1:H1>
I am trying to achieve by simply mapping the columns and setting up the property as "TRIGGER COLUMN: H1PARTYID" to group by the H1PARTYID.

However when I see the payload, I am getting it as: -

Code: Select all

<ns1:OR>
	<ns1:ORParty TransactionType="C">
		<ns2:PartyIdTypeCode>PTY_ID</ns2:PartyIdTypeCode>
		<ns2:PartyId>123456789</ns2:PartyId>
	</ns1:ORParty>
	<ns1:ORParty TransactionType="C">
		<ns2:PartyIdTypeCode>PTY_ID</ns2:PartyIdTypeCode>
		<ns2:PartyId>26789456</ns2:PartyId>
	</ns1:ORParty>	
	<ns1:ORParty TransactionType="C">
		<ns2:PartyIdTypeCode>PTY_ID</ns2:PartyIdTypeCode>
		<ns2:PartyId>987654321</ns2:PartyId>
	</ns1:ORParty>	
	<ns1:ORPreviousRR>H</ns1:ORPreviousRR>
	<ns1:ORCurrentRR>H</ns1:ORCurrentRR>
	<ns1:ORHierarchy>TK</ns1:ORHierarchy>
</ns1:OR>
<ns1:H1>
	<ns1:H1Party TransactionType="C">
		<ns2:PartyIdTypeCode>ProfileId</ns2:PartyIdTypeCode>
		<ns2:PartyId>L063969385</ns2:PartyId>
	</ns1:H1Party>
	<ns1:H1ChannelCd>19</ns1:H1ChannelCd>
	<ns1:H1RR>S</ns1:H1RR>
	<ns1:H1ProfileDate>2015-06-12</ns1:H1ProfileDate>
	<ns1:H1Ind>N</ns1:H1Ind>
</ns1:H1>
So here I am not understanding why this is happening. Can anyone suggest any past experience. I have tried many things like, defining keys to sorting to checking the BestPractice document on Kduke's web page.

Posted: Fri Sep 20, 2013 9:07 am
by chulett
Just want to point out that the Trigger Column has nothing to do with 'grouping'. It is simply a value that - when it changes - forces a change in output filename, closing the current file and opening a new one.

Posted: Fri Sep 20, 2013 1:07 pm
by eostic
Hard to say exactly, but first, definitely use Aggregate, not trigger, put your "key" in the PartyID element, and create a counter upstream that uniquely separates each of the OR elements. They are identical. Force them not to be. Add a fourth column (your counter) that makes sure that they are unique. Give it the same xpath but with its own element name (dummyCounter or something).

See if that gives you the structure you are looking for.....

....then send the xml content downstream to have that dummy column zapped out of it in a Transformer.

Ernie

Posted: Mon Sep 23, 2013 1:10 am
by parag.s.27
Hi,

I cannot use aggregate because the H1Party Node which is the key, repeats with each ORParty (repeating element) element. My requirement is to have the H1 party node appearing only once which cannot happen in Aggregate becuase it will create those many business Payload nodes.

So I get something like this: -

Code: Select all

<ns1: Payload>
<ns1:OR> 
   <ns1:ORParty TransactionType="C"> 
      <ns2:PartyIdTypeCode>PTY_ID</ns2:PartyIdTypeCode> 
      <ns2:PartyId>123456789</ns2:PartyId> 
   </ns1:ORParty> 
   <ns1:ORPreviousRR>H</ns1:ORPreviousRR> 
   <ns1:ORCurrentRR>H</ns1:ORCurrentRR> 
   <ns1:ORHierarchy>TK</ns1:ORHierarchy> 
</ns1:OR> 
<ns1:H1> 
   <ns1:H1Party TransactionType="C"> 
      <ns2:PartyIdTypeCode>ProfileId</ns2:PartyIdTypeCode> 
      <ns2:PartyId>L063969385</ns2:PartyId> 
   </ns1:H1Party> 
   <ns1:H1ChannelCd>19</ns1:H1ChannelCd> 
   <ns1:H1RR>S</ns1:H1RR> 
   <ns1:H1ProfileDate>2015-06-12</ns1:H1ProfileDate> 
   <ns1:H1Ind>N</ns1:H1Ind> 
</ns1:H1>
</ns1: Payload>
<ns1: Payload>
<ns1:OR> 
   <ns1:ORParty TransactionType="C"> 
      <ns2:PartyIdTypeCode>PTY_ID</ns2:PartyIdTypeCode> 
      <ns2:PartyId>987654321</ns2:PartyId> 
   </ns1:ORParty> 
   <ns1:ORPreviousRR>H</ns1:ORPreviousRR> 
   <ns1:ORCurrentRR>H</ns1:ORCurrentRR> 
   <ns1:ORHierarchy>TK</ns1:ORHierarchy> 
</ns1:OR> 
<ns1:H1> 
   <ns1:H1Party TransactionType="C"> 
      <ns2:PartyIdTypeCode>ProfileId</ns2:PartyIdTypeCode> 
      <ns2:PartyId>L063969385</ns2:PartyId> 
   </ns1:H1Party> 
   <ns1:H1ChannelCd>19</ns1:H1ChannelCd> 
   <ns1:H1RR>S</ns1:H1RR> 
   <ns1:H1ProfileDate>2015-06-12</ns1:H1ProfileDate> 
   <ns1:H1Ind>N</ns1:H1Ind> 
</ns1:H1>
</ns1: Payload>

Posted: Mon Sep 23, 2013 8:04 am
by eostic
Based on what you have shown, my only recommendation is what I noted up above...use Aggregate, not trigger, AND add an entirely unique element to the parent above it, by adding a counter column upstream.

Ernie