How to check condition for a variable which have value is empty

HI,

the do while condition should execute until the variable stores’ null/empty. When the variable becomes empty it should come out of the loop. But the loop is not execution

I gave condition is Variable = nothing but loop executing one time only

@pridhvimallikharjun
Is it a string variable? If it is You can use String.IsNullOrEmpty(variable) method for this.

Hi @pridhvimallikharjun

Use this condition

String.IsNullOrEmpty(YourVariable)

It will return true or false

image

1 Like

The variable type is Generic

I have used the condition as String.IsNullOrEmpty (odetteseqno)

though the variable is not empty, is executing only one time

The variable type is Generic

Hi @pridhvimallikharjun

Check out the below workflow which I created to simulate your scenario…

Let know if this works for you…

StringNullOrEmpty.xaml (6.1 KB)

If it is generic, then convert it to string. Like this
String.IsNullOrEmpty (odetteseqno.ToString)

Also if you can just post a screenshot of your condition step in your while

Still not working through.

My scenarios is different please look at my workfloweDoWhile.xaml (8.9 KB)
mphasized text

Please look at the workflowDoWhile.xaml (8.9 KB)

Looks fine to me. Dont see any reason that it should fail unless the variable is empty or null. are you able to see values in the write line?

Yes…Its printing the value in output

One quick check - what is the scope of the variable odetteseqno

when condition is intcount > 0*, is executing infinite times

whereas the loop terminates for the condition String.IsNullOrEmpty (odetteseqno.ToString)

Before the end of the loop, use a write line to print String.IsNullOrEmpty(odetteseqno.ToString).ToString
and observe what’s it printing

odetteseqno is output which provides as input for Scan. I have attached the application screenshot

Tried…it is giving false

Yup! That’s the problem.
How about using Data Scraping to capture all the values into a datatable and use For Each Row activity to loop through the values. Might make it a lot simpler.

Hey wait. Sorry for being dumb all these time! Guess I need more coffee this morning!

You want the loop to continue if the value is not empty right?
So you need to mention while Not String.IsNullOrEmpty(odetteseqno.ToString)

But yes, this is a good approach as well :

1 Like

I tried Data scrapping but the application (Oracle form) not supporting. Error popup "Attribute not supported by the current UiNode

1 Like

I want the loop to continue if the value is empty