cancel
Showing results for 
Search instead for 
Did you mean: 

User Defined Mapping

Former Member
0 Kudos

Hi All,

My Source Structure is

<root>

<Header>

<BankCode>8911</BankCode>

<Bank>State Bank Of India</Bank>

</Header>

<Detail>

<AccountNo>12345</AccountNo>

<ChequeNo>000981</ChequeNo>

<Amount>10000</Amount>

</Detail>

<Detail>

<AccountNo>12345</AccountNo>

<ChequeNo>000982</ChequeNo>

<Amount>50000</Amount>

</Detail>

<Detail>

<AccountNo>12345</AccountNo>

<ChequeNo>000983</ChequeNo>

<Amount>45000</Amount>

</Detail>

</root>

My Target Structure is

<Header>

<BankCode>8911</BankCode>

<Bank>State Bank Of India</Bank>

</Header>

<Detail>

<AccountNo>12345</AccountNo>

<ChequeNo>000981</ChequeNo>

<Amount>10000</Amount>

</Detail>

<Detail>

<AccountNo>12345</AccountNo>

<ChequeNo>000982</ChequeNo>

<Amount>50000</Amount>

</Detail>

<Detail>

<AccountNo>12345</AccountNo>

<ChequeNo>000983</ChequeNo>

<Amount>45000</Amount>

</Detail>

<Trailer>

<TotalCheques>3</TotalCheques>

<Total>105000</Total>

</Trailer>

</root>

My requirement is to add all the amount fields in Detail Node (1:Unbounded) and put it into Total field in Trailer Node (1:1)

I thought of using ResultList and parsing it. If any better solution is there then please Suggest me a Solution.

Thanks in advance.

Regards

Nagesh

Accepted Solutions (1)

Accepted Solutions (1)

bhavesh_kantilal
Active Contributor
0 Kudos

Hi Nagesh,

You can use the SUM function available in Graphical mapping.

AMOUNT --> REMOVE CONTEXT --> SUM --> TARGET FIELD

Regards,

Bhavesh

Answers (2)

Answers (2)

Former Member
0 Kudos

Hi,

Since the details node is 0..ub, I guess you would have to make use of ResultList in a UDF.

You would have to take all the amount tags as input to the UDF, using a String array, and add them by looping through this array.

Regards,

Smitha.

Former Member
0 Kudos

Hi,

Sorry for the wrong input here.

I just tried this out using sum function. This works perfectly. So UDF wouldnt be necessary.

Regards,

Smitha.

Former Member
0 Kudos

Hi All,

The problem got solved.

Thank You

Regards,

Nagesh

Former Member
0 Kudos

Hi,

Map

Amountsum(Statistics)Total

Please try changing the context if the direct mapping does not help.

Regards

Vijaya