on 03-13-2019 7:07 PM
Hello Experts,
I have a requirement for which I might need a UDF.
0000000
0000010
0000020
0000030
0000000
0000000
0000010
0000020
In this example, I have 8 items 0000000 is the Top level Item.0000010, 0000020, 0000030 are supposedly childs of 0000000. Requirement, if 000000 has childs then pass true, else false, else if it is child ie 10, 20, 30 etc, then pass X. Problem: All come under the same level, there is no relation to parent and Child. So suggest me an udf.
I tried searching SDN and did not find any.
Expected Outupt for this scenario
0000000 - true
0000010 - X
0000020 - X
0000030 - X
0000000 - false
0000000 - true
0000010 - X
0000020 - X
Thanks,
Chan
Hi Har` Chan,
How are you getting the source data? is it in a XML? could you please share a sample source XML or the source data?
or you can try this udf - where UDF type is all values of queue and vr is the input queue value and rs is the resultlist- hope this will help
for (int i=0;i<vr.length;i++)
{
if (vr[i].equals("0000000"))
{
if (i == vr.length-1)
{
rs.addValue("false");
}
if (i != vr.length-1)
{
if (!vr[i+1].equals("0000000"))
{
rs.addValue("true");
}
else
rs.addValue("false");
}
}
if (!vr[i].equals("0000000"))
{
rs.addValue("X");
}
}
this will be the output and input -
Thanks
Sugata
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello Har chan
Can you tell which system are you trying to connect on backend ? Where are you sending the data ? If its SAP/ABAP system, I'd do in ABAP as its easy to loop though the contents there instead in UDF in PI.
Let me know if you need ABAP code for the same.
Regards
Ajay
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 | |
10 | |
10 | |
9 | |
7 | |
7 | |
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.