Set value based on range

Hi Experts

Is it possible to use formulas in a switch case to determine which value should be the output based on an input value?

If the input value is:
<=1 then the output should be 1

1 and <=3 then the output should be 3
3 and <=5 then the output should be 5
5 and <=10 then the output should be 10
else the output should be 20

Alternatively I can of course use nested IFs - but is there a nicer way around this?

Hello @jacchr, try this:

If (Condition: input <= 1)
Assign output = 1
Else If (Condition: input <= 3)
Assign output = 3
Else If (Condition: input <= 5)
Assign output = 5
Else If (Condition: input <= 10)
Assign output = 10
Assign output = 20
End If

Cheers! :slight_smile:

1 Like


How about the following expression?

arrInt = {1,3,5,10,20}


arrInt(arrInt.Take(arrInt.Length-1).Count(Function(i) x>i))

Sequence.xaml (5.7 KB)


1 Like

Thanks @Yoichi it was something like that I was looking for

1 Like

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.