on 01-30-2014 9:01 AM
Hi Team,
Good day!
I need to create a mapping to compare values in a context if they are the same or different.
If the values in a particular context are the same, the output should be true.
Otherwise, if the values in a particular context are different, it should result as false.
e.g.
Input are
-------------------------------
1300
1300
1300
---- context change ---
1322
1322
1300
---- context change ---
1311
1311
1300
--------------------------------
the output should be
-------------------------------
true
---- context change ---
false
---- context change ---
false
--------------------------------
Is there a way to implement this logic using SAP PI standard functions in message mapping?
or do I need to create a user defined function for such?
If user defined function is required, could help me with the java code (just the start of the code)?
Thanks,
Carlo
Hi Carlo,
You can achieve this using Node Functions of Message Mapping. Please find below.
Explanation:
Filed1 --------> Sort ( Ascending)
equalsS(Text) -----------> Target.
Field1 ---------> Sort ( Descending)
Use FIeld1 in Both .......
make Context adjustment for field1.... I have maintain record level..
Thanks,
Sreenivas
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Sreenivas,
That's a tricky one! However, in my opinion it also requires a slight improvement to work as expected. In his example, Carlo mentioned that he only needs one value for each context. So you would have to add CollapseContext function before, or after equalsS, to achieve the expected result.
Regards,
Greg
Hello,
Check this UDF:
Execution type: all values of a context
Input: var1
boolean flag = true;
String value=var1[0];
for(int i = 1; i < var1.length; i++)
{
if (var1[i]!= value)
{
flag = false;
break;
}
}
if (flag)
{
result.addValue("true");
}
else
result.addValue("false");
Thanks
Amit Srivastava
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
91 | |
10 | |
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.