Multiple variables in a single if statement

Hi,

I would like to know if there is another way of compiling multiple variables in a single if statement? I have set of 16 numbers and what i did is i put them all in if statement box, such as this;

row(0).ToString = “2xxxxx1” or row(0).ToString = “2xxxxx2” or …

Is there a way i can make it simplify since the numbers i have are almost identical. Thanks in advance.

@julius.mapili,

Put those values into array and then iterate it using for each activity and then compare values.

Maybe you can use regex

It seems that your numbers to compare the input against all iterate on the last two digits. So if you isolate those, it becomes a little easier to manage. The attached does the following:

  1. Sets a maximum and minimum accepted value for the last two digits.
  2. Iterates between these values until the maximum is reached via a Do While loop.
  3. Cleanses the input value so that only the last two digits are used for analysis (e.g. removes the Xs).
  4. Provides a message to indicate if the the value falls within the range.

So you can update the maximum and minimum to whatever number you wish without having to do anything with the condition, reducing overall maintenance.

Main_IterateNumbers.xaml (7.0 KB)

Thank you Guys… awesome!!!

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