Note: To post to a thread, you must be logged in.
Hi All,
I have read thru some of Scott's ORM Primers and still remain confused over an existing project.My project consists of Customers, Functions, Orders linked to a particular function date, and Garments, selected from a stock, used by the customer on the desired date.
Garments come in varying Types and Styles and have ranges of Sizes and Colours. Once a garment is "booked" for a partiular date it is not available for a preset period before and after that date, based on the type of function being attended. There may be multiple garments in a particular Type, Style and Colour.Setting Termary relationships does not seem to cover what I need, and Co-Referencing seems to fall short as well. Obviously I have missed something so could someone point me in the right direction please?
Cheers,
Mark Chimes
Hi mark,
This is a fun situation! I tried modeling it as you described, and made a few assumptions: - A given Function may have many function dates.
- You want to be able to reserve a garment for one of these events, and know when it will be unavailable.
- You want the ability to reserve a garment for JUST ONE function date. You son't wish to be limited to reserving it for every date for that function if at all.
- Every function is of exactly one function type, and each function type reccomends exactly one 'unavailability period'
- I also inferreed that a garment may have more than one colour - a red and black gown, for example.
I did it using TWO ternary fact types, with an equality constraint and a derivation rule. The first ternary fact - probably the one you had that didn't seem to cover it - is "Garment is booked on Date for Function," with a constraint line over the Garment and Date boxes. there's a 'Function is of Function Type', and two fact types connected to Function Type that indicate the number of days before and after, reccomended for that function type.
The second ternary is: "Garment is unavailable from Date to Date." I have two constraint lines: one over Garment and the 'from' Date, and one over Garment and the 'to' Date. This fact type is derived - you can determine this information from those 'number of days' facts on Function Type for the Function that garment is booked for. (Likely derived and stored, hence the ** on the diagram instead of *)
To round it out, I added an equality constraint, showing that every garment that is booked on some date for some function is also unavailable from some date to some date. (This may be better as a subset, if you want to allow garment unavailaility independant of function bookings)
I'll try to send my little diagram to your e-mail shown on these forums. Chances are, you saw it before you even started reading this post. :]