Skip to main content
Nintex Community Menu Bar

How to check for an empty date field?

  • Jul 14, 2017 6:55 PM UTC
  • 15 replies
  • 155 views
  • Translate All

Forum|alt.badge.img+8

Hi,

I have a requirement where I need to check for an empty date field. I do not see a direct way of doing this. One idea I have is to create a workflow variable (Date & Time) and set the default to "blank". Compare the date field against this variable. 

Is this the right approach?

Please advise,

Thank you

15 replies

Forum|alt.badge.img+14
  • Scholar
  • Jul 16, 2017 7:15 PM UTC

do you need to check it in forms or workflow?

Translate

Forum|alt.badge.img+9

Hi ‌,

you can use set a condition action to check date value is empty or not.

205652_pastedImage_1.png

Thanks,

‌

Translate

Forum|alt.badge.img+8
  • Author
  • Jul 17, 2017 6:52 PM UTC

Workflow

Translate

Forum|alt.badge.img+14
  • Scholar
  • Jul 18, 2017 8:52 PM UTC

then both ways, yours and ‌'s bellow are valid.

Translate

Forum|alt.badge.img+13
  • Novice
  • Sep 19, 2017 10:10 AM UTC

Hi,

I've just been looking at this in Workflow 2016 and both Run If and Set a Condition do not allow you to select "is empty" when checking against a date field. I think only string values are allowed to checked for "empty".

‌, is this by design? Are there older versions of workflow that do allow "is empty" against a Date type.

Translate

Forum|alt.badge.img+14
  • Scholar
  • Sep 19, 2017 11:02 AM UTC

have you checked with "Value" and date variable reference or with "Workflow Data" and date variable selected from dropdown?

the former allows to check for emptiness, the later not (at least in NW2013)

Translate

Forum|alt.badge.img+6

I think that's because DateTime type in .NET Framework is not nullable by default, so you can check for null in a CAML query with IsNull or IsNotNull (before you assign a value to a variable), but when you already have a datetime value, it's never empty.

Translate

Forum|alt.badge.img+13
  • Novice
  • Sep 19, 2017 11:06 AM UTC

Querying the column directly

Translate

Forum|alt.badge.img+14
  • Scholar
  • Sep 19, 2017 11:10 AM UTC

does it allow you to change Condition dropdown to something like 'if any value equals value", like in former version(s)?

Translate

Forum|alt.badge.img+13
  • Novice
  • Sep 19, 2017 11:12 AM UTC

You mean like this?

Translate

Forum|alt.badge.img+14
  • Scholar
  • Sep 19, 2017 11:39 AM UTC

not really.

I meant it just like on ‌'s screenshot from above

207881_pastedImage_1.png

Translate

Forum|alt.badge.img+13
  • Novice
  • Sep 19, 2017 11:41 AM UTC

ah right, yes, I see what you mean. Yes that does still work I'm glad to say. A bit tucked away and inconsistent isn't it?

Translate

Forum|alt.badge.img+14
  • Scholar
  • Sep 19, 2017 8:50 PM UTC

fortunatelly there is at least this possibility, even likely not intentional happy.png

Translate

Forum|alt.badge.img+4

We're still running on SharePoint2010, so it might no longer be correct what I'm saying. It helps to remember that the first possible date is January 1, 1900 (needs to be confirmed). Whenever a date already had any content, you can't clear it that easily. So what I would do is I'd clear the date (that would actually change the date to 1/1/1900 - as i said i'm not 100% sure its that exact date).

So when I check whether a date is empty, I check for emptiness AND being smaller than.... 1984 (my dob)

Translate

Forum|alt.badge.img+16

this is awesome!  I didn't know you could do this!

Translate