cancel
Showing results for 
Search instead for 
Did you mean: 

adding up of amount fields in the xml payload

Former Member
0 Kudos

HI ,

I have a issue on hand in mapping .

I am using message mapping to map the source to the target.

The issue is I have a item data in the source message which contains the Amount field . also it has some charge nodes also under it which also has a amount field.

what i need to do is to add all the amount fields from the charge item into the amount of the item field and then map it to the target.

the Source struct is some what as below

Item

|->Amount

|-> ChargeItem

|-> Amount

|-> ChargeItem

|-> Amount

Item(2)

|->Amount

|-> ChargeItem

|-> Amount

|-> ChargeItem

|-> Amount

The target required is somewhat like below

Item

|-> Amount (item(amount) + charge (amount))

Item (2)

|-> Amount (item(amount) + charge (amount))

Hope u can get the issue

Thanks

Nikhil

Accepted Solutions (1)

Accepted Solutions (1)

bhavesh_kantilal
Active Contributor
0 Kudos

Hi,

You can use the statistical function SUM.

Make the context of chargeItem-->AMOUNT to ITEM and then use the STATISTICAL function SUM,

Regards,

Bhavesh

Former Member
0 Kudos

Hi Bhavesh,

Thanks for the reply. but i have a question.

this will deal with the amount of the charge item but what about the amount of the amount field in item.

how can we take care of that too. as cannot map more than 1 field to the target.

and more over we have to add that field too to the sum of charge item

Thanks

Nikhil

bhavesh_kantilal
Active Contributor
0 Kudos

Nikhil,

<i>this will deal with the amount of the charge item but what about the amount of the amount field in item.</i>

Write a simple UDF that will take the input of the SUM of AMount of Charge Item and the Amount field of item as inputs and sum these togther and map this to the target.

Regards,

bhavesh

Former Member
0 Kudos

Hi,

You can use:

item-amount --sum

item-charge---sum ---add ---amount

U can use sum to add them and use ADD functionality to add both the sum amount.

Regards

Vijaya

Former Member
0 Kudos

HI

thanks I was able to figure it out

Thanks for ur help.

Nikhil

Answers (0)