Switch case to check range of number

Hi, I would like to use the switch case to check a number between two range inside each case.
Check the below image, I am getting error. Not able to do this. Please share your suggestons.

1 Like

Fine we can check like this
In expression be like
Convert.ToDouble(in_amount) > 78 And Convert.ToDouble(in_amount) < 4557

And in case mention as True and another case with value as False

Cheers @sarathi125



As the error is mentioning Case value should be a double.

It depends on your requirements, but give a try to implement a mapping logic to assig a number to certain class/segment/category (name it as you feel ok) and then use this segment value in the switch activity

hey @sarathi125

You can check like this

Convert.ToDouble(in_amount) >= 78 And Convert.ToDouble(in_amount) <= 4557

And in case mention as True and another case with value as False

or if you are having more ranges then you can opt for nested if else.


1 Like

I need to check that amount range from 1-5000,
5000-10000, 10000>. Three cases should be used. Not only two.

1 Like

Hey Yes so it is not much cases so you can easily use if Activity here.


Yeah, then I have to use three if statements. If we have this switch similar to VB.nwt select then only one switch actually. Will check

1 Like

Yah we can use this expression in switch expression as input
IF (Convert.ToDouble(in_amount) > 1, “Greater than 1
IF(Convert.ToDouble(in_amount) < 5000, “Lesser than 5000”,
IF(Convert.ToDouble(in_amount) > 5000, “Greater than 5000”,
IF(Convert.ToDouble(in_amount) < 10000,”Lesser than 10000”,
IF(Convert.ToDouble(in_amount) > 10000,”Greater than 10000”,
“Less than 1”)))))

And mention the string mentioned above in the cases as value like Greater than 1 for case1, Lesser than 500 for case2… it goes on

Hope this would help you
Cheers @sarathi125


Have a look on Integer Division

Int Division Operator:
amount 1 - 5000 Int Division 5000 = 0
amount 5000 - 10000 Int Division 5000 = 1

amount greater then 10000 Int Division 5000 is default case in the switch

Hi @sarathi125

Buddy check it out this attachment :slight_smile: :wink:

SelectSwitchVb.xaml (4.2 KB)

Cheers :slight_smile:



By far the best answer in this thread.

With this case can you output the result in arguments too? And use a varibale threshold? I’m imagining with input as double:

Select Case inAmount
Case 0 To lowThreshold
Case lowThreshold To highThreshold
Case >highThreshold
End Select

Would this work?

The “Case value” can be only a constant value.
Not range, not variable.
This is the limitation of the activity :frowning:



Hey @SoqedHozi

Off course it will :slight_smile:

It is possible just in case when you do not want to consider Optimization as a factor :slight_smile:

For your understanding find below sample as per your need :slight_smile:
SelectSwitchVb-With Variable Argument Cases -Aksh1yadav.xaml (4.5 KB)


@sarathi125 are you able to resolve this? can you update the solution

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