Solved

Groovy evaluator

  • 29 August 2022
  • 6 replies
  • 151 views

How do I write else if loop in groovy evaluator 

Example: the if-else loop in expression evaluator is written in below way: 

${record:value('/phone_home[0]') != ' ' ? record:value('/phone_home[0]'):

(record:value('/phone_home[1]') != ' ' ? record:value('/phone_home[1]'):

(record:value('/phone_home[2]') != ' ' ? record:value('/phone_home[2]'): ' '))}

 

How do I implement Same-Example thing in groovy evaluator,

Since there are dynamic number of rows coming each time, [sometimes number is 10, sometimes 100 etc, so need to write for-loop]

icon

Best answer by saleempothiwala 29 August 2022, 17:02

View original

6 replies

Userlevel 4
Badge
@Priyanka Mynepally

if(condition) {   
   statement #1   
} else if(condition) {   
   statement #2   
} else {   
   statement #3   

 

@Bikram  shared some code earlier about looping using Evaluators. Let me find the thread for you.

Userlevel 4
Badge

@Priyanka Mynepally 

 

Here: 

 

You can use the same concept in Groovy and iterate for all the phone numbers.

It was helpful. Thanks,

Could you please help me with groovy-code as well.

Userlevel 4
Badge

@Priyanka Mynepally please share the sample data

same data as in before example

same data used in jython example

Reply