cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
kasia
Nintex Newbie

Check if string variable is empty

Jump to solution

Hi,

Nintex newbie here.

I am setting a string variable from a field in a list item. The field is optional, so I need to know whether the variable contains a value or not. 

I am using a 'Run If' action to check the variable, but I only get options to check if the variable is 'equals' or 'not equals' to a value. There is no 'is empty' option.

I created another variable, and I am not setting a value to it, thereby leaving it null, and then I am comparing the two variables. It's not working, however.

Is there another way I can use to do this?

Many thanks in advance! 

Kasia.

Tags (2)
0 Kudos
Reply
5 Replies
TomaszPoszytek
Nintex Newbie

Re: Check if string variable is empty

Jump to solution

Hello again Kasia  Certainly, for "Run If" there is no such possibility

I did the following workaround for such purpose:

  1. I have defined a text variable, but didn't set any value to it -ex.: var_EmptyString;
  2. Then I made a comparison in "Run If": variableToCompareIfEmtpy is equal var_EmptyString.

Regards,

Tomasz

Reply
kasia
Nintex Newbie

Re: Check if string variable is empty

Jump to solution

Hi again!

Thanks for your reply. 

If you look at my screenshot above, I think I did exactly what you described. And it just doesn't work. The code should not run if the variable is empty, right? But it runs.

Kasia.

Reply
TomaszPoszytek
Nintex Newbie

Re: Check if string variable is empty

Jump to solution

Oh... My bad. I haven't deeply read your question, just scrolled the text and thus I got not a complete view  sorry.

But on the other hand for the "Text" variables in "Run If" action you do have the option "is empty":

Maybe the variable you are trying to inspect is not a text, but a collection or sth?

I now realized that I used that workaround for the "Wait for Field Change in Current Item" action to check if the field "Check-out" is empty or not.

Regards,

Tomasz

Reply
kasia
Nintex Newbie

Re: Check if string variable is empty

Jump to solution

YES! That was the problem. So silly... My variable was a Person, not string. That's why I didn't have the 'is empty' option.

Thank you!

Reply
Warwick
Nintex Newbie

Re: Check if string variable is empty

Jump to solution

To compare against a Blank variable in Office 365 you need to create 2 variables.

vtxtBlank1 = blank

vtxtBlank2 = blank

Then in the workflow set vtxtBlank2 = vtxtBlank1 which will effectively give you a Null value rather than blank

Then you can use the run if vtxtColumn1 = vtxtBlank2 (null)...

There are a few post regarding this.

Reply