on 02-28-2013 6:45 PM
Hi
I have a E1FISEG segment with occurrence 0...999.
My source message is as below
Invoice
VendorLine
GLLine
Taxcode
Taxamt
GLLine
Taxcode
Taxamt
This segment needs to repeat as below
1. Once for Vendor data
This is working. VendorLine mapped to E1FISEG.
2. Once for every GL Line.
For this I have duplicated the subtree for the above segment - E1FISEG[1].
This is working fine. GLLine mapped to E1FISEG[1]
3. The GLLines can have different tax codes. I have to calculate the total of tax amount per tax code within an invoice. I have done this using below mapping.
For this I have duplicated the subtree once more to get E1FISEG[2].
I am able to sort the values per tax code for the tax amount as indicated below.
I now need to sum the amount per tax code - sum(V0) = 0; sum(V1) = 50, sum(V2) = 20.
I need to create one E1FISEG[2] for every sum that is greater than 0 - thus here I expect 2 E1FISEG[2] segments in output.
Please help.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Girish,
Use the below code in UDF with other Node Functions as mentioned in the screenshot. It should work.
Hi Girish,
Try with UDF, would be much easier than normal graphical mapping.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You can try something like below. <taxcode1> and <taxcode2> both have same input. After that UDF SplitbyValue. May be syntax error present, check in your editor.
public void SumAmount(String[] taxcode1, String[] taxamnt, String[] taxcode2 ResultList result, Container container) throws StreamTransformationException{
for (int i=0;i<taxcode1.length;i++)
{
for (int j=0;j<taxcode2.length;j++)
{
int sum = 0;
if (taxcode1[i].equals(taxcode2[j]))
{
sum = sum + Integer.parseInt(taxamnt[j]);
}
if (sum > 0)
result.addValue("");
}
}
User | Count |
---|---|
98 | |
11 | |
11 | |
10 | |
10 | |
8 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.