Need UDF to Compare two values of 2 different contexts and give the count based on successful comparison in SAP PI

huangapple 未分类评论48阅读模式
英文:

Need UDF to Compare two values of 2 different contexts and give the count based on successful comparison in SAP PI

问题

int flag, count = 0;
for (int i = 0; i < POSNR.length; i++) {
flag = 0;
for (int j = 0; j < POSNR1.length; j++) {
if (POSNR[i].equals(POSNR1[j])) {
result.addValue("1");
flag = 1;
break;
}
}
if (flag == 0)
result.addValue("0");
}

英文:

I am facing problem in UDF. Please help me out.

From each context E1EDL24 we need to take POSNR value and match it with the first another context E1EDL37/E1EDL44 POSNR value. If it matches make 'count' as 1. Then check the next first context E1EDL37/E1EDL44 POSNR value and if we get the match 'count' will increase by 1 and so on.
If no matches 'count' will be zero.

I have tried writing UDF it is iterating only the number of times the input is given.

UDF :

**int flag,count=0;
for(int i=0;i&lt;POSNR.length;i++)
{
flag=0;
for(int j=0;j&lt;POSNR1.length;j++)
{
if(POSNR[i].equals(POSNR1[j]))
{
result.addValue(&quot;1&quot;);
flag=1;
break;
}
}
if(flag==0)
result.addValue(&quot;0&quot;);
}**

huangapple
  • 本文由 发表于 2020年6月29日 14:52:12
  • 转载请务必保留本文链接:https://java.coder-hub.com/62632688.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定