Jump to content
View in the app

A better way to browse. Learn more.

FMForums.com

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Using date rages in calculation fields

Featured Replies

Hi there,

I am trying to build in a series of 10 text message fields that tell a user if a course date falls within one of the 4 school holiday periods of a year. There are 10 course dates in a repeating field. The school holiday fields are global date fields. The calculation formula for message 1 is as follows:

Case((DayOfYear ( All_Course_Dates[1] ) ? DayOfYear ( Easter_Break_Ends ) and DayOfYear ( All_Course_Dates[1] ) ? DayOfYear ( Easter_Break_Starts )); "Easter Break";

(DayOfYear ( All_Course_Dates[1]) ? DayOfYear ( Winter_Break_Starts) and DayOfYear ( All_Course_Dates[1] ) ? DayOfYear ( Winter_Break_Ends )); "Winter Break";

(DayOfYear ( All_Course_Dates[1] ) ? DayOfYear ( Spring_Break_Starts ) and ( All_Course_Dates[1] ) ? DayOfYear ( Spring_Break_Ends )); "Spring Break" ; DayOfYear ( All_Course_Dates[1] ) ? DayOfYear ( Summer_Break_Starts ); "Summer Break"; "")

Im having no luck and all I get is the "Summer Break" result in some cases. Is there a better way of doing this? I cant find any "Date Range"formula steps which would be very handy - that is a formula that gives a true/false result when a date is compared to a start period and end period date.

Cheers,

brainonastick

  • Author

The above pasted text has replaced the 'greater than or equal to' and 'less than or equal to' signs with 'question marks' for some reason. heres the formula again with the <= and >= reentered.

Case((DayOfYear ( All_Course_Dates[2] ) <= DayOfYear ( Easter_Break_Ends ) and DayOfYear ( All_Course_Dates[2] ) >= DayOfYear ( Easter_Break_Starts )); "Easter Break";

(DayOfYear ( All_Course_Dates[2]) >= DayOfYear ( Winter_Break_Starts) and DayOfYear ( All_Course_Dates[2] ) <= DayOfYear ( Winter_Break_Ends )); "Winter Break";

(DayOfYear ( All_Course_Dates[2] ) >= DayOfYear ( Spring_Break_Starts ) and ( All_Course_Dates[2] ) <= DayOfYear ( Spring_Break_Ends )); "Spring Break" ; DayOfYear ( All_Course_Dates[2] ) >= DayOfYear ( Summer_Break_Starts ); "Summer Break"; "")

Cheers

brainonastick

I would approach this a little differently. Use a second table to hold the Holiday ranges, and relate to that range with a multi-criteria relationship:

Main::All_Course_Dates >= Holiday::Holiday_Start_Date

AND Main::All_Course_Dates <= Holiday::Holiday_End_Date

If there is a match for this relationship, then the All_Course_Date is in the range of a holiday. You can test this a calculation:

Holiday? (calculation, number result) = not isempty(Holiday::RecordID)

I don't know how this would behave with your repeating field. I would get rid of the repeating field and use another table for the Course_Dates.

You need to use the CalculationRepetitionNumber. Something like:

Let ( [ R = Get ( CalculationRepetitionNumber ) ] ; Case ( R = 1 ; Case ....

etc.

Create an account or sign in to comment

Important Information

By using this site, you agree to our Terms of Use.

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.