I'm currently developing an app for collecting Conflict of Interest Declarations.
Every year there is an annual cycle in which every employee must submit a new declaration. I've created a feature for HR to set an Annual cycle with Start date, End date, and Cycle name. This data is stored in a separate list from the declarations.
There should only ever be one Cycle that can be live over any given period, and they should never cross over. Currently I have some visual cues to indicate if cycle is live based on today's date is on or between the Start and End dates. However, I would like to prevent HR from accidentally creating cycles with date crossover by disabling the save button if there is crossover with an already saved Cycle.
I'm not entirely sure how to achieve this though. I thought about using the Sequence function to list all dates between start and end dates (inclusive) of each cycle already created, and comparing with a Sequence of dates between the start and end dates of a new cycle HR are setting up and disabling the save button if any dates in either list match.
I understand the basics of Sequence, but not sure if this is the best function to achieve what I want, nor how apply it in this context.
I have attached a screenshot of the screen I've built for this which should hopefully give some context. You'll see the Yellow/Red colours on the items in the gallery on the left, these are two cycles that are currently 'live'.
Any help will be greatly appreciated.