How to give condition if variable is null or empty on that time program won't exicute

Hello family, I need to execute my workflow like this if the variable is null or empty I won’t execute the program or workflow like this I gave code `

(Not String.IsNullOrEmpty(Subject) and not string.IsNullOrEmpty(DocBody))

My intention is if both variables empty then the flow should stop but what I use above code it is only seeing the subject it is not going to the body like it not look the body is empty are not its look only subject what to do can anyone explain

Thanks
Chethan P

Hi @copy_writes,

In your case, I would try a nested if.
If condition 1
Then If Condition 2
… do something

Best regards,
MArius

hi @Marius_Puscasu if i do like nested if then performance is slow know
Thanks @Marius_Puscasu

Hi @copy_writes,

Try rewriting the condition like this:
Not String.IsNullOrEmpty(Subject) andAlso Not string.IsNullOrEmpty(DocBody)
Then it will work I hope so.
Hope its helps.
Thanks!!!

1 Like

No buddy it’s not working :expressionless: see the bellow screenshot the doc is null but it takes the data I give subject as testing its a value in the subject variable but it was looking only at the subject if the subject has value mnz it takes to the then value

image

1 Like

Thanks for responding @copy_writes .
Please give one more try with this:
Not string.IsNullOrWhiteSpace(Subject) andAlso not Not string.IsNullOrWhiteSpace(DocBody)

IsNullOrWhiteSpace() method for strings which generalizes the IsNullOrEmpty() method to also include other white space besides empty string.

2 Likes

Hoo its working Buddy Thank you so much :beers:

1 Like

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