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

hide based on a date

Jump to solution

Hello all,

I am trying to hide a field on my form if the date  of my "departureDate" field is before 1/3/19 (first of march 2019.)

Any help greatly appreciated. I feel that i must have tried every combo except the correct one. The idea is a text box ("BrexitWarning) appears if staff are planning to travel abroad after this date  

0 Kudos
Reply
6 Replies
Nintex Employee
Nintex Employee

Re: hide based on a date

Jump to solution

Hi Cy,

You should be able to accomplish this using the 'DateDiffDays' runtime function evaluating the difference between the date you are running against, the current date, and the date entered in the control. To show behind the curtain a bit, I am using a calculated value control, but the same setup could be done using a form variable if you dont want to show the date differential on the form.

First, add your date picker control, your warning label and your calculated value control (or form variable).

Next specify a name for your date control

Next configure the calculated value control with the DateDiffs.  Specifically in this scenario I am wanting to calculate the time between the date control and today  and the time between the Brexit warning and today. This will look something like dateDiffDays(Date, Current Date) - dateDiffDays(Current Date, "2/28/2019")

Make sure you also specify a name for this control if you are using a calculated value.


From there, you'll setup your rule to hide the Brexit warning using the name of the calculated value control (or form variable) and use a less than or equal to <= "0". 

Here are a few dates specified. **NOTE**I'm using an American calendar so the dates will be flipped for you.

Warning Hidden:

Warning Showing:

0 Kudos
Reply
Nintex Employee
Nintex Employee

Re: hide based on a date

Jump to solution

I'm leaving the first response as it might help people with date differentials, but I was overthinking it.  The easiest way of doing this would be the configuration below: 

Keep the configuration with the date control described above. I named the control Date. Setup a rule on the label control to hide with the formula with date <= convertToDate("2/28/2019") 

Below is rule firing and hiding the Label on an early date:

Below is the later date that will trigger the control showing on the form:

Reply
marven
Nintex Newbie

Re: hide based on a date

Jump to solution

Brilliant stuff Dan, thank you very much. I have learnt two things  .  I started at the top but was not sure why you had the larger formula and i used  a variable and the formula - dateDiffDays(DepartureDate, "15/04/2019"),  as date diff only gives a positive value (3rd thing learnt),  I used a date a few weeks after the date then hide when the variable was under 15 (this basically hid the control except during April).  I then used another rule to hide when departure date was blank.

Then i read the bottom bit, had a laugh then made that work too.

Obviously there is always more so....

I was looking at hiding between dates using your second method (convertToDate). I was using between say jan 20th and jan 25th as an example. I have used every combo of <> && || , except perhaps the correct one . I see it is easy using two rules, one for each but it would be tidier if i just used 1. Thanks again for you time on this, much appreciated.

Cy

0 Kudos
Reply
Nintex Employee
Nintex Employee

Re: hide based on a date

Jump to solution

Using your example, we'll only show the warning between 1/20 and 1/25, it will look something like this:

View solution in original post

Reply
marven
Nintex Newbie

Re: hide based on a date

Jump to solution

Again thanks Dan, really helpful. 

0 Kudos
Reply
Ryuojiin
Nintex Newbie

Re: hide based on a date

Jump to solution

Hi, 

 

Sorry to bother you. 

 

I'm trying to do something that looks like this but my aim is more of a disable the field  or form itself when editing an item if the current date is less than 24 hours of the date of meeting (field) is less than 24.

 

My form is kinda of a reservation where in you can't change your submitted reservation if the date of the meeting is today or less than 24 hours. I'd reall appreciate the help.

0 Kudos
Reply