You are viewing limited content. For full access, please sign in.

Question

Question

Field Rule for Date Between Two Days of Any Given Year

asked on February 25

I have a hidden date field that always fills in the current date by default. I want to use that date to achieve what you see in the image below but instead of 2025, I want it to be for any year. I want that section to display only when the current date of any year is between 7/1/XXXX and 8/1XXXX so that no human intervention is necessary for changing the year in the field rules. Is there a way to use a token there? My attempts have not worked.

0 0

Answer

SELECTED ANSWER
replied on February 25

I checked this on Forms 11 classic and it seems to all be supported.  You could just use a single Month textbox and set the calculation to MONTH(TODAY()).  The date field on mine makes it convenient to test with.  Here's the field rule:

2 0

Replies

replied on February 25

You can use field formulas to validate this based upon the numerical day and month. The final formula here will return TRUE or FALSE to a text field.

01# Breaking it down in to steps so you can see the logic
02# 1. Combine today's month and day
03=CONCATENATE(MONTH(<your date field>),DAY(<your date field>))
04 
05# 2. Do the same for 7/1 and 8/1; year doesn't matter since you're only using month+day
06=CONCATENATE(MONTH(DATE(2025,7,1)),DAY(DATE(2025,7,1)))
07=CONCATENATE(MONTH(DATE(2025,8,1)),DAY(DATE(2025,8,1)))
08 
09# 3. Is today between those two values? (Is today's MM+dd GT 0701 and LT 0801)
10=IF(AND(GT(CONCATENATE(MONTH(<your date field>),DAY(<your date field>)),CONCATENATE(MONTH(DATE(2025,7,1)),DAY(DATE(2025,7,1)))),LT(CONCATENATE(MONTH(<your date field>),DAY(<your date field>)),CONCATENATE(MONTH(DATE(2025,8,1)),DAY(DATE(2025,8,1)))),TRUE,FALSE)

This may require some more specific comparison than what I've written (since you may need to compare the month separately from the day) but this should give you a starting point.

2 0
replied on February 25

You can also remove its dependency on the year by using YEAR(TODAY()) instead of hard coding 2025

1 0
replied on February 25

I was not able to find a way to do what you are attempting with the form's options, tokens woud be fantastic.  I built a calendar in SQL with each calendar date and then Event Window Start and End dates for several years out for different events we have during the year.  This way the current date pulls start and end dates into hidden form date fields.  I use a 3rd field to determine if the current date falls within the start and end dates and then use I additional show/hide rules to what is accessible based on the current date.

It's a bit of work to setup, but now I only have to update my table in SQL every few years instead of the form.

0 0
replied on February 25 Show version history

Tricky... it looks like version 11 doesn't support tokens (for the comparison value).  I think it supports calculations so this may work.

Make a hidden field called "Month".  Set the calculation in this field to be as follows:

"Current_Date" in the token is the variable for your hidden "Current Date" field.

Set your field rule like this:

I'm using forms 12 but I'm pretty sure this was supported in forms 11 and it should display so long as the current month is in July of any year.

0 0
replied on February 25 Show version history

This is form made with the classic designer, not the modern designer, and I can't convert it as there is a lot of JavaScripting that will break if I do. 

0 0
replied on February 25

I missed that part... 

0 0
replied on February 25

I appreciate your input though. It may prove useful on forms I create using the modern form designer!

0 0
replied on February 25

Well... version 12 classic forms supports calculations on fields.  I can't remember if 11 did or not:

0 0
SELECTED ANSWER
replied on February 25

I checked this on Forms 11 classic and it seems to all be supported.  You could just use a single Month textbox and set the calculation to MONTH(TODAY()).  The date field on mine makes it convenient to test with.  Here's the field rule:

2 0
replied on February 25

Yes! Was just trying this out and it worked perfectly :)  YAY!

0 0
replied on February 25

Glad it worked even though I didn't read all of the relevant information about the problem smiley!

0 0
You are not allowed to follow up in this post.

Sign in to reply to this post.