Using Portals to Create Calendars

We often use the technique of placing seven portals next to each other to create calendar-like views within FileMaker. You can create a portal and relationship for each day of the week and include in the match values a _kf_dayofWeek value that ensures that only Mondays appear in the first portal, Tuesdays in the second, and so on. To your users this will feel like a completely natural calendar. You will need seven relationshipsone for each day of the weekand will need a data table in which one record equates to a single day.

Be careful to ensure you have all your date records available. If you have missing records, you might get your days out of sync and display, say, Tuesday 14th to the right of Monday 6th. FileMaker will display records in each portal in order. If you have a Tuesday missing, for example, any Tuesday records that follow will appear to be out of sync with the other days of the week. This approach depends on your having data records for each full week that you choose to display in this way.

The obvious shortcoming to this technique is that you cannot use a scrollbar. Given that you have seven portals side by side, scrolling one portal would not behave intuitively for users (Saturday, for example, would scroll but none of the other days would). In these cases, we will often choose to create page-up/page-down routines that increment and decrement a "seed" date that controls the first records in each portal. If a user clicks your page-up button, the routine simply subtracts 7 from each date. Likewise, clicking the page-down button adds 7 to each date. To learn how to apply this technique, refer to "Filtered Portals" later in this chapter.

Note that a variance to this technique is to create a data table of week records, instead of days, with a field for each day. This is a significantly simpler data model that does away with the scrolling and syncing problem we discuss previously; however, it's a rare system that can be served without discrete day records. Your reporting capabilities will be significantly limited by week-based records.

Selection Portals

Категории