on 06-12-2018 5:59 PM
Hello Gurus,
Below is my input XML and need help to generate the output XML via graphical mapping.
INPUT xml :
<Products>
<Product>
<MATNR>A</MATNR>
<Desc>mat1</Desc>
</Product>
<Product>
<MATNR>B</MATNR>
<Desc>mat2</Desc>
</Product>
</Products>
<Partner>
<Customer>
<NAME>X</NAME>
<ACTIVE>0</ACTIVE>
</Customer>
<Customer>
<NAME>Y</NAME>
<ACTIVE>0</ACTIVE>
</Customer>
</Partner>
i need to generate every combination of 1product 1customer. Can you help if this is possible in graphical mapping.
OUTPUT XML :
<ActiveCust>
<Material>
<MATNR>A</MATNR>
<Desc>mat1</Desc>
<NAME>X</NAME>
<ACTIVE>0</ACTIVE>
</Material>
<Material>
<MATNR>A</MATNR>
<Desc>mat1</Desc>
<NAME>Y</NAME>
<ACTIVE>0</ACTIVE>
</Material>
<Material>
<MATNR>B</MATNR>
<Desc>mat2</Desc>
<NAME>X</NAME>
<ACTIVE>0</ACTIVE>
</Material>
<Material>
<MATNR>B</MATNR>
<Desc>mat2</Desc>
<NAME>Y</NAME>
<ACTIVE>0</ACTIVE>
</Material>
</ActiveCust>
Hello,
Can you please help with the logic or pseudo code how to proceed.
Thanks.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi
you have to play with the context here.
just try as below
1.For parent node "Material"-use the UDF1 to create the context as you needed.(input1- product and input2-customer both input should not have context changes)
2. For MATNR/DESC - use UDF1 along with split by value node function.(input1-MATNR/DESC and input2-Name. both the input should have context changes)
3. For Name/Active - use UDF2 along with split by value node function.(input1 - MATNR and Input2- Name/Active. both the input should not have context changes)
UDF1:
public void cal1(String[] var1, ResultList result, String[] var2, Container container) throws StreamTransformationException{
for (int i=0;i<var1.length;i++)
for(int j=0;j<var2.length;j++)
result.addValue(var1[i]);
}
UDF2:
public void cal2(String[] var1, ResultList result, String[] var2, Container container) throws StreamTransformationException{
for (int i=0;i<var1.length;i++)
for(int j=0;j<var2.length;j++)
result.addValue(var2[j]);
}
Regards,
Malathi
User | Count |
---|---|
77 | |
11 | |
10 | |
8 | |
6 | |
6 | |
6 | |
6 | |
5 | |
5 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.