You can easily modify CC Calendar to flag appointments which conflict with each other, even if their times only overlap partially. The trick is to build a new relationship in CCCalendar that will be true if the two appointments share enough criteria to be considered in conflict. Once that relationship is in place you can choose to display the conflict any number of ways (see "Going Further" below).
The example below is based on CC Calendar Pro and assumes that all an appointments attributes must match for a conflict to be true. That is, the appointments must share at least one of the same Users, be of the same Type and overlap and least some of the same date and time. In many deployments "type" won't make sense as a conflict attribute, so you can leave it out of what follows.
Getting Ready
CC Calendar Pro comes with almost everything you need to setup this conflict relationship. However, you'll need to modify the ApptKeyTimeRangeCalc in CCCalAppts first. This calc ends like this:
- Code: Select all
) // End Let
// Thanks to Mikhail Edoshin for this greta trick! - js
)
You'll want to insert the following before that parentheses in the ") // End Let" line so that the calc now ends like this:
- Code: Select all
// New Code
& "¶" &
"X" &
Substitute(
Left(Right("0000000" & MinuteStart; 8); 8) & "¶" &
Left(Right("0000000" & MinuteStart; 8); 7) & "¶" &
Left(Right("0000000" & MinuteStart; 8); 6) & "¶" &
Left(Right("0000000" & MinuteStart; 8); 5) & "¶" &
Left(Right("0000000" & MinuteStart; 8); 4) & "¶" &
Left(Right("0000000" & MinuteStart; 8); 3) & "¶" &
Left(Right("0000000" & MinuteStart; 8); 2) & "¶" &
Left(Right("0000000" & MinuteStart; 8); 1);
"¶";
"¶X"
)
// End New Code
)// End Let
// Thanks to Mikhail Edoshin for this greta trick! - js
)
Note that the "¶" above is the paragraph symbol.
Creating the Conflict Relationship
Once you've edited that field you can move to the Graph in the CCCalendar file. Here you want to add another table occurrence of the Appointments table in the CCalAppts file. Call this table occurrence "AppointmentsDailyConflict" and make it the same green as the other occurrences of this table. Next you'll define a relationship between these two table occurrences: this relationship will be true if there is more than one appointment with the same conflict criteria. Define your relationship as follows:
That's it.
Displaying the Conflict
The easiest way to display this conflict is to add a checkbox to the Mini Window Edit Appointment layout (since this is where you'd be making the conflicting appointment). Build a checkbox field formatted like the one for "repeating". That field is a button, so be sure to disable the button action if you copy it. Once you have a checkbox field, specify it to show the CommonOne field from the table occurrence "AppointmentsDailyConflict" which we created above. Set this checkbox to use the value list "one" which is already defined in CCCalendar.
Now you'll see that checkbox light up when you have a conflicting appointment.
Going further
Here are a couple suggestions for other cool things to do in this area.
Hidden Portals. Since we have a relationship that is only true when there are conflicts, we can make a one-row portal using this relationship. Then, anything inside the portal will only show up if there is a conflict with the current appointment. So, on the Mini Window Edit Appointment layout you could add some text in red like "Conflict Detected" and place this inside your one-row portal.
Show Conflicts. You could also create a button that would show you the conflicting records. You'd want to show them by duplicating the layout Mini Window Show Repetitions and changing the portal on the right side (and all the field within it) to use your AppointmentsDailyConflict. You can check out the Show / Hide Repetitions buttons to get examples of the GotoRelatedRecord and window management you'll need here.
Showing Conflicts Elsewhere. Remember that we defined the conflicting relationship inside the graph of CCCalendar, NOT CCCalAppts. Thus, the conflict information is not available to the appointment. If you want to show possible conflicts in other interfaces where you have appointments (in your own solution, perhaps) you'll want to create a relationship like AppointmentsDailyConflict inside the CCCalAppts file. You can then define fields in the Appointments table there that would display warnings if there are conflicts and such fields could be displayed alongside the appointment anywhere you choose.