on 05-11-2007 7:12 PM
I do a Price-RemoveContexts-Sum-Add to existing amounts in my XI math calculation. It works perfect when testing a single record. It adds all of the correct values and gives the correct sum amount.
However, when testing with multiple records in a file the values are incorrect. Is there an XI function I am missing that may easily remedy this problem?
I did an a SplitByValue that worked but affected another mapping's result negatively in the file so I removed it.
Not sure my problem will be that easy to fix.
Thank-You.
Message was edited by:
Tom M.
Hi Tom,
if you want to add all prices under each Records then you can use removeContext.
i.e <Records>
<ParentNode>
<Price>1</Price>
<Price>2</Price>
<Price>3</Price>
</ParentNode>
<ParentNode>
<Price>4</Price>
<Price>5</Price>
<Price>6</Price>
</ParentNode>
<ParentNode>
<Price>7</Price>
<Price>8</Price>
</ParentNode>
<Records>
in the above example if you use removeContext for <b>Price</b> element,you will get <b>sum</b> function output value 36,its sum of all price values.
i Guess now you r clear with removeContext node function.
Cheers,
Jag
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Tom,
If you have price element in structure as follows
Records 1 .Unbounded
ParentNode 1 1
Price 1 Unbounded
then you dont have to use removeContext node function.
If you have structure as follows.
Records 1 .Unbounded
ParentNode1 1 Unbounded
Price 1 1
Then also you dont have to use removeContext node function. You just right click on Price node in Data flow editor and change context to Records.
Cheers,
Jag
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I believe, RemoveContext function is making the difference here. Since it is working fine with one record, you did not have any problems with the mapping as there is only one record and all of them are added to one value. But when you have multiple records, and the Remove Contexts function works on all of the values at the message level, and hence, it will add the values of all the records (since now thy are under the message level contexts).
I sense, if you remove the remove context function and just map the repeating source element to the target element, it should solve the problem.
Vijay
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
What incorrection?
It seems the values arent been added at all, or you have decimal algharisms error (like it was supposed to be 4.56 but was 4.53)?
Regards,
Henrique.
PS: Also, please send us the source and target Message structures, since mapping functions will depend on the structure. See, you only need RemoveContext if you have a tag over the Price tag. But you'll also need some treatment to create the tags in target (as for example CollapseContext, etc).
Just send us the message types and we'll try to sort it out.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
88 | |
23 | |
11 | |
9 | |
8 | |
5 | |
5 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.