Solved

lookup from list of values

  • 10 January 2022
  • 5 replies
  • 23 views

i have a XML which has an element country and i have to check whether this country is part of my list.

country in (‘USA’,’AUS’)

is there any component where i can configure or i have to write in Evaluator to handle this logic

 

icon

Best answer by dima 10 January 2022, 14:23

View original

5 replies

Userlevel 2
Badge

As far as I know, there's no specific string-in-list-of-strings type of function, but our Expression Language should be able to handle this. In particular, your expression can combine checking if the record value matches some string (e.g.,,’USA’) with the logical or operator to chain it with the other values. 

i have gone through the page and i could find only value compared against only value but not value against list of values. if i miss anything please direct me to correct page

Userlevel 2
Badge

Yes, that's what I said. Just chain two value-against-value functions with the logical or. 

i was able to achieve like below in expression evaluator componenet, but is it efficient way or is there any other way 

 

${record:value('/lastName') == 'US'} || ${record:value('/lastName') == 'CA’}

Userlevel 2
Badge

That's the way I'd do it. :)

Reply