Adding another filter?

Support, Questions and Suggestions for the FM7 Version of CC Calendar.
PostPosted: Mon Nov 07, 2005 9:16 am
Most calendar events are related to a specific property record in our database. I want to create a script in our solution that will open the calendar and show only appointments related to the subject property, in the "month" view, starting with the current month we are in.

I dug into the calendar structure a bit, trying to figure out how to do this, and I decided that it may be more efficient to just post here, as I'm sure you guys have done something similar to this already.

Currently, our SubjectPropID field is related to apptSubjectPropID field in your Appointments table.

Thanks, guys.

Nate
SeedCode Staff
SeedCode Staff
Posts: 2764
Joined: Thu Nov 20, 2003 11:01 am
PostPosted: Tue Nov 08, 2005 4:40 am
(Sorry for the delay in replying!)

As you've suggested, a new filter is a good way to do this; you can then set that filter in your script. Once you have the ID you want to filter on in the CCCalAppts (Appointments) table, you'll create a calculated version of the field to use as your key. This calc would be in the same form as ApptKeyUserCalc, adding a carriage return and a "-" after your ID. Make sure this calc returns the type text.

Then in the calendar table you'll need a global field to hold the ID of the property you wish to see. If you wish to follow the structure of the calendar's other filters (so that you can show or hide a given property) you'll need 4 fields in the form of

CalFilterUserGlob
CalFilterUserShowHideGlob
CalLinkUserCalc
CalFilterUserShowDisplayCalc
CalFilterUserHideDisplayCalc

Note that these are also all of the type (text). Once the field are in place you'll add a pair of them to the 7 month relationships between CalendarMonthWeek and AppointmensMoWk1-7. Use the pair of "User" relationship criteria as your model. You'd likely want to add the same to the relationship between CalendarDaily and AppointmentsDaily.

Be sure to add steps for your new filters to the scripts "Filters - Clear" and "Show / Hide Filter" so that the show, hide, and clear buttons around your new filter will work.

Going further.

If you wish other aspects of the calendar to respect the filters then you'll have to go further. These other aspects of the calendar include the hours portal on the day and week views, the mini-calendars on the daily view, and the scheduling tab (in the Scheduling Edition). These areas of the calendar use different filter tables (tables other than calendar) and you'd need to add global fields for your property ID to these other tables as well. This is pretty easy as you can simply add versions of your globals wherever you see versions of

CalFilterUserGlob
CalFilterUserShowHideGlob

That would be in the Days table and the Hours table. You'd then edit the relationship criteria for these other aspects of the calendar (hours, the mini-calendars, and the scheduling tab) to include your new pair of criteria. Finally, you'd add a couple lines to the script "Filter Calendar - Pass Filters" to pass your filters to the hours and days table.

Hope that helps.
John Sindelar
SeedCode

Return to CC Calendar (FM7/8)

Who is online

Users browsing this forum: No registered users and 3 guests

cron
(855) SEEDCODE
[email protected]
Follow us: