How can I check if a Number field is empty?

  • 30 November 2016
  • 5 replies
  • 22 views

Badge +7

Hello!

I want to check (in a loop) if a number field is empty or not. Can I achieve this with greater than/less then etc.?

I want to go into the loop in case the field is empty.

I tried (as a workaround) to save my number fields as text variables in my workflow and check if they are empty ('is empty' and 'is not empty' are not available in the number settings).

The problem is that the workflow does not enter the loop so it does not notice that the text variables are empty.

Any ideas?


5 replies

Badge +7

I could do it with regular expressions as a workaround.. is there an easier way though?

Badge +11

Hi thzu thzu

In the workflow, create a single line text variable which will allow for blank and then convert the text variable to numeric using Convert Value action. Then compare your field against this variable. You could also put some validation to make sure numeric values are entered. Hope that helps.

Badge +2

Hello,

I'm having the same problem but with this solution I get an error in the Convert Value action:

Error parsing value. Value '' is not compatible with the selected output variable type List Item ID (integer).

Am I doing it right?

Thanks

Badge +11

Hi Jaume Ribas

If you are trying to compare if the ID is empty, then this would not work. ID is an integer and not a number.

You would be able to compare ID as empty straight in the comparison, have you tried that? I don't have On-prem environment so i can't test the exact situation. Let us know.

Badge +2

Hi Kapil Joshi

The list field I'm trying to compare is a Number field, but the variable I was using was type Integer, I guess that explains the "List Item ID (integer)" in the error. I did another test with a Number variable and the error is this other one:

Error parsing value. Value '' is not compatible with the selected output variable type Number (double).

I ended up storing the field in a Single line of text variable and to my surprise the value for empty is "0". This is fine for my case, but could be problematic if 0 was a possible valid value. I did a test with a Set a condition action comparing the field value directly with the value 0 and for an empty value the action says they're equal.

Reply