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

Validation rule to hide panel when current month is not September through December

Jump to solution

Hi all, 

 

I'm looking to create a rule to hide a panel when the current month is not equal to September through December. 

 

I tried calculating the dates and then hiding the panel for dates greater than or equal to 01-01-2019 and less than 01-09-2019. However I didn't quite manage that and I realised this rule would have to be revised come 2020.

 

So I thought I could go with the runtime function: contains(). The idea is to hide the panel if the current date does not contain "september" etc.

 

I used the following rule: 

!contains(txt_CurrentDate, "september") && !contains(txt_CurrentDate, "oktober") && !contains(txt_CurrentDate, "november") && !contains(txt_CurrentDate, "december")

 

txt_CurrentDate is a calculated value control that references the CurrentDate, saved as a string.

I checked the date format, for example today would be: woensdag 24 april 2019 00:00:00 (date culture NL-nl).

 

Also, I tried to test the above rule, by using the function dateAddMonths(). 

 

I can't get this to work. "woensdag 24 oktober 2019 00:00:00", for example, still hides the panel.

 

What am I doing wrong? Thanks!

 

 

Labels: (1)
0 Kudos
Reply
3 Replies
chaddavis
Nintex Newbie

Re: Validation rule to hide panel when current month is not September through December

Jump to solution

Why not use the FormatDate() function, and use either 'MMM' or 'MMMM' to pull only the month value from your date field?

 

If the date fell within the month of December, this would return the abbreviation 'Dec':

 

formatDate(<DateField>,'MMM')

This one would return the full month spelled out 'December':

formatDate(<DateField>,'MMMM')

Then you should be able to use != (not equal) instead of !contains().

 

0 Kudos
Reply
emha
Nintex Newbie

Re: Validation rule to hide panel when current month is not September through December

Jump to solution

formula seems to be correct at first sight.

question is how exactly do you convert CurrentDate into txt_CurrentDate - you may be fooled by how forms interpret and displays - it may still be of Date (object) type and it's just displayed acc. your current locale.

 

 

anyway I'd suggest easier/more understandable formula like

1*formatDate(CurrentDate,"MM") < 9

 

Reply
yvette
Nintex Newbie

Re: Validation rule to hide panel when current month is not September through December

Jump to solution

So simple, yet brilliant!

Thank you!

0 Kudos
Reply