on 08-27-2008 7:56 PM
Hi folks here i am having a requirement as that.... I will be gettind a file as
Node Line
-
Sum
Node Item
-
SUT
-
10
Node Item
-
DAT
-
20
Node Item
-
SUT
-
30
.
.
.
.
.
.
So iN the above case IF I need to add all the values of all the instances of the field SUT. i need to sum all the values when the above field gets the value SUT. but we dont know the exact number of instances of SUT.
Do we have any option in XI message mapping or we need to go for UDF. if we need to go for UDF please let me know the code, as I am not familiar with JAVA it will be helpful for me . Thanking you all..
Ramana
can u show the XML structure of the message? That would be helpful to understand the nodes and the elements.
regards
rajeev
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi ,
PLease find my requirement a bit clear below.
Source structure::::::
<CRMLINE>
<CRMSL>
<AMT>233.0</AMT>
<QL>DAT</QL>
</CRMSL>
- <CRMSL>
<AMT>97500.0</AMT>
<QL>SQL</QL>
</CRMSL>
- <CRMSL>
<AMT>344.0</AMT>
<QL>DAT</QL>
</CRMSL>
Targer Structure:::::::
<CRMLINE>
<Total>
Here in the above Stucture i just need to add all the amounts in the CRMSL only when the Ql in CRMSL is DAT....and i need to pass the result to TOTAL in the CRMLINE tag. Let me know any inputs.
create the following UDF with 2 arguments..
1)
sum(String[] a, String[] b, ResultList result)
{
int totalDAT = 0;
for ( int i = 0; i < a.length; i++ )
{
if ( "DAT".equals(a<i>) )
{
totalDAT += Interget.parseInt(b<i>);
}
}
result.addValue( ""+totalDAT );
}
Save & Close the uDF
2) Go the mapping editor....Drag and drop the UDF. It expects 2 arguments.
Pass QL, AMT in the same order to the function and map the target to ur target element.
3) Change the context of AMT and QL to CRMLINE instead of CRMSL
AMT
QL
User | Count |
---|---|
95 | |
11 | |
10 | |
9 | |
9 | |
7 | |
6 | |
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.