# check an array has mix of values

I have a condition where if a list contains only numbers as 10, i.e{10,10,10,10} I should  return 1 else If list contains any numbers apart from 10 i.e{23,50,60} I have to return   0 else if that list contains mix of 10 and other numbers {10,23,45} then I have to return as 2. how can i write this in expression rule ?

Discussion posts and replies are publicly visible

Parents
• You can compare a list of values to a single value and it will return a list of booleans for each.

and({10,10,10,10} = 10) => true

and({10,10,10,11} = 10) => false

or({10,10,10,11} = 10) => true

or({23,50,60} = 10) => false

Using an and() would check for all values equal 10. Using an or() would check for at least one value equals 10. That should get your three cases covered.

• You can compare a list of values to a single value and it will return a list of booleans for each.

and({10,10,10,10} = 10) => true

and({10,10,10,11} = 10) => false

or({10,10,10,11} = 10) => true

or({23,50,60} = 10) => false

Using an and() would check for all values equal 10. Using an or() would check for at least one value equals 10. That should get your three cases covered.

Children
No Data