cancel
Showing results for 
Search instead for 
Did you mean: 

help on the following udf

former_member452321
Participant
0 Kudos

Hi

I wrote the following udf to get the out out from notes .If each line item there are 5 notes and if any of them contains text example Test it should create only one target node Notes. I have data with first line item has one note with Test and remaining line 3 line items doesnot have that data in any of the notes .But it is creating the target notes in each line item .

boolean find  = false;
for(int j = 0; j<edp01.length;j++)
{
  for(int i = 0; i <  ekpo2.length; i++)
  {


   if (var1[i].equals("Test")||
        var2[i].equals("Test")||    
         var3[i].equals("Test")||
        
     {
   result.addValue("Y");
   find = true;
   break;
     }
  }


  if (!find)

  result.addValue("N");
}

z1ekpo2>mapwithdefault>removecontext>
zzmltnote1>mapwithdefault>removecontext>
zzmltnote2>mapwithdefault>removecontext >  UDF >EQUALS>Y >CREATEIF>nOTES
zzmltnote3>mapwithdefault>removecontext>
                                    edpo1>

All context set to E1EDP01

Not sure context issue or something is not correct in udf

Thanks for your help

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

try as below - remove boolean


for(int j = 0; j<edp01.length;j++)

{

  for(int i = 0; i <  ekpo2.length; i++)

  {

   if (var1[i].equals("test") || var2[i].equals("test") || var3[i].equals("test"))    {

       result.addValue("Y");

     }else{

       result.addValue("N");

  }

}

}

Regards

Ramg

former_member452321
Participant
0 Kudos

Thank you. It has created 4 target notes in fisrst item level .In first item I have only one matching value .Expecting only one 1 node for first item level. What should be context value . I set it to E1EDP01

former_member452321
Participant
0 Kudos

display of udf attached . there are only four line items but getting so  many values of N and Y from udf . there should be first 4 . first line item Y and remaining N . again it it looping looks like


Former Member
0 Kudos

can you post the source structure and what is the expected output. based on screen shot - edp01 is the line item??

former_member452321
Participant
0 Kudos


yes .Yes EDP01 is line item in each line item at any time only one value in 10 following notes  may or may not contain contain that Test value . if it contains we should create one note in target on that line item. similar for other line items also.

EDP01

   Z1EKPO2
        ZZMLTNOTE1
        .
         .

.         ZZMLTNOTE10