Support Portal

for ProcessRobot and WinAutomation

Start a new topic

how do I use list command in an If statement

So I want to write an if statement that say this.

If "text string A" contains a number  then do x

I have tried 

If %newvar% contains (0-9) then do x   but it dosnt work.

I have tried just about every combination of dashes and brackets that I can think of and nothing seems to work. If I use a single number it works fine. 

for example i Used "if %newvar% contains 3 the do x" and that works fine. I just cant get it to do it for any number/

1 Comment

If statement does *not* support "List".

You can instead parse the string variable with regular expression and test as below.

Parse Text action of your string %var_a%

... save position: %var_pos%

....check option regular expression 

... check first match only 

... use regular expression of below in Text to find:   \d

Note: \d represents digit 0 - 9

If you want to know if your string only contains a number, then use instead regular expression:


If %var_pos% >= 0

...... number in string %var_a%

End If

1 person likes this
Login or Signup to post a comment