seraph_nyc Posted April 13, 2007 Posted April 13, 2007 Hi, I am creating a calender type function. The database has a history of performance which someone is doing. The performances may be ongoing meaning stretch into next year. I want to create a way of adding a performer to a performance. But first I need to check availability and check schedule conflicts. I have each performance with a start date and end date and a calculated date range. In essence I need a way of check to see if any date ranges over lap. I am thinking of doing a script which goes thru each day of a performance and see if it falls with any other performance, but this is time consuming. I am looking into self joining with a range of dates, but it isn't quite working well. Any idea?
Ender Posted April 13, 2007 Posted April 13, 2007 This should be possible by testing for the presence of a record over a range-to-range relationship. The relationship would look something like: Interface <=> Performance = Interface::gStartDate ≤ Performance::End Date AND Interface::gEndDate ≥ Performance::Start Date Where the dates to test are gStartDate and gEndDate. To then test for the presence of a related record, use: If [ isempty(Performance::RecordID) ] #No record exists in specified range ... End If
seraph_nyc Posted April 16, 2007 Author Posted April 16, 2007 Thank you. I made a few modifications but it works. The IF(empty) record ID part did not work thou. If there is a conflict is found then all the records with a conflict is there. If there isnt one then no records are found.
Ender Posted April 16, 2007 Posted April 16, 2007 I'm not sure what you had trouble with. The If[] step tests for the presence of related records. If there are matching records, then there is a conflict and the If[] would return 0, if there are no matching records, then there are no records with dates that overlap the specified range, and the If[] returns a 1.
Recommended Posts
This topic is 6432 days old. Please don't post here. Open a new topic instead.
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now