While loop

I have a while loop where i run a process until a condition its met. I want the loop to run until either my variable its false or if another variable contains a string. How can i do this in the condition of the while loop?

hi
cant you put in your activity in try catch , can manage through it

no because the rest of the workflow wont comp with it. Just need a singel line to check
“if var1 = true or if var2 do not contain a string”

You can simply add those conditions in your while loop, you can use the field as if it was an IF condition

yh know, but dont know the code for it

it keep looping even tho my var2 has a string

Hi,

Use the OR myString**.contains** See sample below:

image

Good Luck and Happy Automation! :smiley:

crashing. Getting VisualBasicValue: Object reference not set to an instance of an object.

you can write in the condition something like

var1=True OR var2 is not Empty

var1 being of type boolean, and var2 of type string

What is the type of your “var2” ? try to avoid using “generic”.
You have to be more specific if you want us to understand your problem, a “string” is a very elusive concept, as “123”;“hello”;“b” and even " " are strings.
what exactly contains your “var2”, and in which conditions do you want it to be considered as a string ?

SO_ROW_EXIST = true or M3_INSURANCE = “”

This one causes no crash but it keeps looping even tho my string its filled

The var 2 its a string and the var1 its a bool

use is not empty instead of “”

cant find the word empty ?

nothing* my bad, nothing not empty

for more reliability you can use String.IsNullOrEmpty(M3_INSURANCE) = true

is the string is null or empty, returns true, else, return false

1 Like

getting error " is-operator do not accept operator of type int. operator must be referencetype or types that can have zerovalues.

My var1 its a bool tho so dont know what they mean

are you using an equal? the “is” replaces the “=” sign

this makes no crash but still makes the loop go on

using the Is