cancel
Showing results for 
Search instead for 
Did you mean: 

Adding the line items in mapping

former_member182412
Active Contributor
0 Kudos

Hi Experts,

I got the structure like this.

Item (0 to unbounded)

amount (1 to 1).

I am getting more than one amounts, I need to add all the amounts and map it to target field "sum".

For this how can i do the mapping can anybody please help me.

Kind Regards,

Kumar

Accepted Solutions (1)

Accepted Solutions (1)

VijayKonam
Active Contributor
0 Kudos

hi,

you can directly use the Sum function provided by the Graphical Mapping utility. Usually the SUM function works at context level. Set your context accordingly by looking in to the Q and finish it up.

VJ

Former Member
0 Kudos

hi.

but me too hava the same problem.

here when the amounts r integers its working but the sum is not working of the values r in float i.e decimal like 443.356 like this.

wat we can do to solve this problem.

waiting for u .

bye.

regards.

seeta ram.

Answers (4)

Answers (4)

Former Member
0 Kudos

hi

if u use string type for amount field change it to integer type ,also change string type to integer type for target field.....

if u give the input as 34.45,34.67,34.67

u ill be getting 103.7899 instead of 103.79..

in sum function ....last digit in decimal u wont be getting exact value instead u ill get in terms of .699 for .7

Message was edited by:

sasitharan

Former Member
0 Kudos

hi.

yeh what u r saying is closer to my scenario.

so can u just tell me the solution to get the exact decimal value.

waiting for your response.

bye.

regards.

seeta ram.

Former Member
0 Kudos

hi

what u see in the display queue for "sum" function...r u getting input values...

Former Member
0 Kudos

yeh iam getting input values but its not summing correct.

the sum is not returning approximate values with decimals.

the problem is with decimal values.

waiting for your response.

bye.

Former Member
0 Kudos

hi

for Amount field ---(set the context to message type node)

then Map directly amount field to sum (statistic functions)

then connect the sum function to target field....

hope this helpful....

Message was edited by:

sasitharan

Former Member
0 Kudos

hi.

thanks for u r answer.

yes i set the context to message type node.

even then the sum is not returning the correct value.

waiting for u r response.

bye.

Former Member
0 Kudos

hi.

thanks for u r answer.

yes i set the context to message type node.

even then the sum is not returning the correct value.

waiting for u r response.

bye.

Former Member
0 Kudos

hi,

jus use display queue to set the context rite..there shudnt be any problem

regards,

latika.

Former Member
0 Kudos

hi latika .

i saw the display queve it is getting the input values but its not summing correctly.

especially its not showing the approximate deciam values lets say the sum should be 15488.335 but its showing 15488.29

waiting for u r response.

cheers.

seeta ram.

Former Member
0 Kudos

hi,

this means various the values are getting rounded off in between so that u r getting this much variation in the result.

vat field type r u using?

Former Member
0 Kudos

hi.

here iam using xsd.integer data type for both sorce and target.

so can u tell me the solution please.

bye.

regards.

Former Member
0 Kudos

hi,

not sure hw to correct decimals in standard function sum !!!

but a work around can be using a UDF!!

regards,

latika.

Former Member
0 Kudos

hi litika.

k thanks for your help but can u give me the udf with all the code stuff to sum amounts in body .

waiting for your response.

bye.

regards.

thanku.

henrique_pinto
Active Contributor
0 Kudos

Use standard functions with BigDecimal variables instead of float.

Check this blog to refer on how to do that: /people/thorsten.nordholmsbirk/blog/2006/08/25/new-arithmetic-and-statistical-functions-in-message-mappings-in-sp18

Regards,

Henrique.

Former Member
0 Kudos

Hi Praveen,

As just suggested above that you can go for SUM function and change the context to ITEM node .

If its not working then you can write an ADVANCE UDF where all the Amoutns will be coming as Input and then add and return the same

REgards