Jump to content
Claris Engage 2025 - March 25-26 Austin Texas ×
The Claris Museum: The Vault of FileMaker Antiquities at Claris Engage 2025! ×

This topic is 4148 days old. Please don't post here. Open a new topic instead.

Recommended Posts

Posted

I am building a schedule generation database, and I'm trying to figure out an efficient way to identify schedule conflicts between classes.  Each class can have up to 5 meeting times.  I've got a way that works, but it's very brute force and I think there has to be a better way.

 

Currently, I've got a Student in Classes table related to itself by student ID and a non-equal Student in Class ID.  In other words, they will connect for all of the classes that a student is in other than the particular class being referenced.  Through this relationship, I'm checking for class time conflicts using this calculation:

 

Case ( sgClassTimes::timeStart ≥ sgClassTimesCONFLICT::timeStart and sgClassTimes::timeStart ≤ sgClassTimesCONFLICT::timeEnd ; "conflict" ; GetNthRecord ( sgClassTimes::timeStart ; 2 ) ≥ sgClassTimesCONFLICT::timeStart and GetNthRecord ( sgClassTimes::timeStart ; 2 ) ≤ sgClassTimesCONFLICT::timeEnd ; "conflict" ;  GetNthRecord ( sgClassTimes::timeStart ; 2 ) ≥ GetNthRecord ( sgClassTimesCONFLICT::timeStart ; 2 ) and GetNthRecord ( sgClassTimes::timeStart ; 2 ) ≤ GetNthRecord ( sgClassTimesCONFLICT::timeEnd ; 2 ) ; "conflict" ; "" )

 

The table with CONFLICT in the name is the reciprocal table.  The formula above works for classes with up to two meeting times, but I need to go up to 5 and doing that in this way will lead to a very long calculation.  Ideally, I'd like something that checks for a conflict in ANY matching record, rather than having to go through them all 1 by 1 using GetNthRecord.

 

Any suggestions?  I apologize if I haven't explained this well, and please don't hesitate to ask if you need any more information.

 

Thanks!

Dave

Posted

Here is one way to do it. If you don't want to store date ranges with the records, you can use a script instead of relationships to collect/calculate/compare the relevant values on the fly and detect any conflicts.

 

EDIT: Eliminated a TO and streamlined the very roundabout method to collect ranges.

Conflict_eos.fmp12.zip

  • Like 1
Posted

Thanks for sharing this!  Unfortunately, I'm using FM 11 so I can't open the file.  I've thought about doing it with a script, though, and I was actually working on a solution in that vein today.  I'd love to see your file, if it isn't too much trouble to save it in an FM 11 compatible format.

 

Thanks again!

This topic is 4148 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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

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