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:
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!
Solved! Go 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':
This one would return the full month spelled out 'December':
Then you should be able to use != (not equal) instead of !contains().
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