IBM®
Skip to main content
    Country/region select      Terms of use
 
 
   
     Home      Products      Services & solutions      Support & downloads      My account     

 
developerWorks
AIX and UNIX
Information Mgmt
Lotus
New to Lotus
Products
How to buy
Downloads
Live demos
Technical library
Training
Support
Forums & community
Events
Rational
Tivoli
WebSphere
Java™ technology
Linux
Open source
SOA and Web services
Web development
XML
My developerWorks
About dW
Submit content
Feedback


Notes/Domino Tutorials


Creating Calendar Views


Back to Main Menu

Introduction

Designing a Calendar View
Create a Calendar View
Events that Span a Day or More
Events that Fill a Specific Time Period
Display All Calendar Entries in the Same View
Calendar View Properties
Available @Functions and @Commands for Calendaring and Scheduling

Exercises
Before You Begin
Create a Calendar View
Create an Action Bar with New @Commands
Solutions

Introduction

The Calendar view is a view style that allows documents, organized by date and time, to appear in a calendar format. This tutorial covers the tasks involved in creating a Calendar view, including:
  • Creating a Calendar view
  • Using new @Commands associated with a Calendar view
  • Using Calendar view properties to customize the view

    There are self-paced exercises to test the skills learned. To complete the exercises, there is a database to download with a default form to use.

    The Creating Calendar Views Learning Byte is a self-directed learning item targeted for existing application developers at the Application Development I level.

    Back to Table of Contents


    Designing a Calendar View


    Create a Calendar View
    Calendar views are appropriate for any application displaying time-oriented documents such as a database that maintains a project schedule. Calendar views are used in the Notes mail template as well as other Calendaring and Scheduling applications.

    Types of Calendar Entries
    When creating a Calendar view, there are two types of calendar entries to consider:
  • Entries that contain a single date or range of dates such as an anniversary, event, or task.
  • Entries that contain a start date- time field, and a way to compute or enter the duration of the event in minutes. An example is a meeting.

    A Calendar view can contain documents with both types of calendar entries if you accommodate for them in the view column formulas.
    Steps to Create a Calendar View
    Creating a calendar view is similar to creating a standard outline view.

    Steps:
      1. Select Create - > Design -> View from the menu.

      2. Click Shared or leave the view private.

      3. Click Options. For Inherit design from:, choose Blank. Select Design now and click OK until you are in view design mode.

      4. Change the style of the view by selecting Design -> View Properties from the menu. Change Style to Calendar.

      Designing the View
      The view design screen looks the same as the design screen for the standard outline view. However, to display documents in a Calendar format, design the view with the following requirements:
      • Column one must contain a time-date value. The time portion is required because it is used for indexing. This column should be sorted and hidden to display the time slots for the date.
      • Column two contains the duration of the event in minutes. Events that span an entire day, such as an anniversary, should have a duration of zero (0). Use a column formula to generate the duration or select a field in a document that contains the duration figure. This column should be hidden.
      • Create a view selection formula for the view to select the documents containing the time-date value.

        Although not required, the following columns are used to improve the views appearance:
        • Column three and subsequent columns contain the text that is displayed for the event.
        • For time-based events, use the third column to hold the starting time of the event and the fourth column to hold the description. This ensures that the event appears in the correct time slot.
            Display Options
            The default display of the Calendar is a one-week format. You can switch to a two-day, one week, two-week, or one-month view of the calendar. Select View -> Calendar to change to a different format.

            Back to Table of Contents

            Events that Span a Day or More
            Some events appear multiple times on a calendar. One example of a day or multiple-day event is a training class. For an event to appear on multiple days of a calendar, column one must refer to a multi-value date field or use a formula to create a multi-value list of dates. A list is a named entity that can contain multiple values of the same type.

            Using @Explode to Obtain a List of Dates
            Use @Explode to create a list of dates to display on a calendar view. @Explode returns a text list composed of the elements of a text string or date range.

            Syntax

            @Explode( dateRange )

            DateRange is a time-date range or time-date range list. This is a range of dates whose individual days you want to make into a text list.

            Sample Scenario
            The training staff would like to see the scheduled training classes in a calendar format. In the Training Schedule Database, there is a form called "Schedule Training" which contains the following field names and properties:
          • StartDate is the starting date for the training class. This is a time field which displays a date value and does not allow multiple values.
          • EndDate is the ending date for the training class. This is a time field which displays the date value.
          • Description is a text field which displays the training class name.
              Designing the View
              The view contains three columns and a selection formula. Use the scenario information above when reviewing the formulas for each of the columns for the calendar view.

              View Selection Formula
              Set the view selection formula to the form that contains the time-date variables.

              SELECT Form = "Schedule Training"

              Column One
              Column one must contain a time-date value. To allow a training to appear on multiple days in a calendar create a formula in column one modeled on the information below:
              • Create a temporary variable to combine the start date and end date of the event. This creates a date range. DateRange is the temporary variable.

                DateRange: = @TextToTime(@Text(StartDate) +" - " +@Text(EndDate))
              • Use @Explode to return a list of dates from the temporary variable DateRange. Then, convert the list of dates to a time-date value.

                @TextToTime(@Explode(DateRange))
              • Include a start time for the event using @Time. For full-day or multiple-day events, set the value to 12:01 am. This time value is combined with the list of dates to create a list of time-date values.

                @Time(00,01,00)
              • Combine all the statements to create a multi-line formula.

                DateRange:=@TextToTime(@Text(StartDate) + "-" + @Text(EndDate));
                @TextToTime(@Explode(DateRange)+ " " +@Text(@Time(00;01;00)))

                Column Properties
                Set the properties to:
                • Hidden: This prevents the time slots that Notes displays automatically from being overwritten.
                • Sorted in ascending order: Full-day events will sort to the top of the view.
                • "Show multiple values as separate entries": This allows events to appear on multiple days within the calendar.

                  Column Two
                  Column two contains the duration of the event in minutes. For a full-day or multiple-day calendar entry (such as a training class), the duration column is irrelevant. Place a zero (0) in the formula window for this column.

                  Properties
                  Set the properties for this column to Hidden. If the column is not hidden, the duration figure will display as part of the description of the event.

                  Column Three
                  The third column contains a description of the event. The Description field is used for the sample scenario.

                  Back to Table of Contents


                  Events that Fill a Specific Time Period
                  Some events fill a particular time slot on a calendar. An example of this is a meeting or appointment. The column design is slightly different for time-based events.

                  Sample Scenario
                  The department staff views the upcoming meetings for the department in a calendar format. The database is named Department Schedule and there is a form called "Schedule Meeting." The form contains the following field names and properties:

                  • StartDate is the date of the meeting. This is a time field which displays a date value.
                  • StartTime is the starting time of the meeting. This is a time field which displays a time value.
                  • EndTime is the ending time of the meeting. This is a time field which displays a time value.
                  • Description is a text field which displays the subject of the meeting.
                      Designing the View
                      The view contains four and a selection formula. Use the scenario information above when reviewing the formulas for each of the columns for the calendar view.

                      View Selection Formula
                      A view selection statement is created.

                      SELECT Form = "Schedule Meeting"

                      Back to Table of Contents


                      Display All Calendar Entries in the Same View
                      A calendar view can contain calendar entries that span multiple days and entries that fill specific time slots. To arrange this, modify the column formulas to conditionally test for the type of calendar entry.

                      Sample Scenario
                      The department staff views a calendar in the Department Schedule database. The calendar shows the scheduled meetings and events for the staff. In the database, there is a form named "Schedule Event" which contains the following field names and properties:

                      • EventType is a keyword field which evaluates to "1" if the event selected is a meeting, or "2" if it is an event that lasts a day or more.
                      • StartDate is the starting date for the event. This is a time field which displays a date and does not allow multiple values.
                      • EndDate is the ending date for the events that do not fill specific time slots. This is a time field which displays a date.
                      • StartTime is the starting time for events that fill a specific time slot. This is a time field which displays a time.
                      • EndTime is the ending time for events that fill a specific time slot. This is a time field which displays a time.
                      • Description is a text field which displays the description of the event.
                          Designing the View
                          The view contains four columns and a selection formula. Use the scenario information above when reviewing the formulas for each of the columns for the calendar view.

                          View Selection Formula
                          Set the view selection formula to the form that contains the time-date variables.

                          SELECT Form = "Schedule Event"

                          Column One
                          Column one must contain a time-date value. Use an @IF formula to test for the entry type "1" if the event is a meeting or "2" if it is an event. Create a formula in column one modeled on the information below:
                          • Create a temporary variable to combine the start date and end date for the full and multiple day events. @Explode creates a list of dates. DateRange is the temporary variable.

                            DateRange := @Explode(@TextToTime(@Text(StartDate) + "-" + @Text(EndDate)))

                          • Use an @IF formula to determine the event type and the resulting time-date value.

                            @If(EventType="1";@TextToTime(@Text(StartDate) + " " + @Text(StartTime));
                            @TextToTime((DateRange)+ " " + @Text(@Time(0;1;0))))
                          • Combine all the statements to create a multi-line formula.

                            DateRange := @Explode(@TextToTime(@Text(StartDate) + "-" + @Text(EndDate)));
                            @If(EventType="1";@TextToTime(@Text(StartDate) + " " + @Text(StartTime));
                            @TextToTime((DateRange)+ " " + @Text(@Time(0;1;0))))

                            Column Two
                            Use an @IF formula to determine the duration of the event. For full-day events, the value equates to
                            zero. Create a formula in column two modeled on the information below:

                            @If(eventType = "1"; (EndTime-StartTime)/60;"0")

                            Column Three
                            Use an @IF formula to determine the time slot description. If the entry is an event, the @function evaluates to "-All Day-", otherwise the start time of the appointment displays. An example of the formula is below:

                            @If(eventType="2";"-All Day-";StartTime)

                            Column Four
                            Displays the description of the event. The Description field is used to populate this column.

                            Back to Table of Contents
                              Calendar View Properties
                              Many of the properties available for outline style views are also available for the calendar style. When calendar is selected for a view style, two new tabs are added to the view properties InfoBox:
                            • Time reference
                            • Font selection

                              The table outlines the options available on the new tabs and the additions to the Style tab.

                              Back to Table of Contents


                              Available @Functions and @Commands for Calendaring and Scheduling

                              New @Functions
                              There are a variety of @Functions and @Commands available for Calendaring and Scheduling. The table summarizes the list.

                              Using @Commands in a Calendar View
                              Two new commands that work with Calendar views are the CalendarFormat and CalendarGoTo commands.

                              CalendarFormat Command
                              The CalendarFormat command changes the calendar view display to one of four options: two days, one week, two weeks, or one month.

                              Syntax

                              @Command( [CalendarFormat] ; number )

                              The number parameter is optional. With no parameters, CalendarFormat cycles to the next calendar display option, in this order: two days, one week, two weeks, and one month. Use the following values to change to a specific display:

                            • Use "2" to display the calendar as a two-day display.
                            • Use "7" to display the calendar as a one-week display.
                            • Use "14" to display the calendar as a two-week display.
                            • Use "30" to display the calendar as a one-month display.

                              CalendarGoTo
                              The CalendarGoTo command goes to a particular date in a Calendar view.

                              Syntax

                              @Command( [CalendarGoTo] ; timedate )

                              Timedate is an optional parameter. Enclose the desired date in square brackets, for example [1/1/97]. Any @Functions that return a time-date value, such as @Now,@Today,@Yesterday, and @Tomorrow can be used as the date parameter. If the parameter is omitted, CalendarGoTo displays the View CalendarGoTo dialog box.

                              Back to Table of Contents

                              Exercises



                              Before You Begin

                              Download the Exercise Database
                              The following exercises will test what was learned in the previous lessons. The database Department Schedule is attached and should be used to complete the exercises.

                              Procedure

                              1. Download the Department Schedule database file (DeptSch.nsf).
                              DeptSch.nsf

                              2. Place the file in the \notes\data subdirectory and add the database to your workspace.

                              Back to Table of Contents


                              Create a Calendar View
                              In the following exercise, create a Calendar view in the Department Schedule database (DeptSch.nsf). This database shows all the events scheduled for the upcoming months. There is a standard outline view available named "By Date." The department staff members, however, want to see upcoming events in a calendar format.

                              Steps

                              1. Open the database Department Schedule DeptSch.nsf

                              2. To familiarize yourself with the "Schedule Event " form, create two documents: one for a meeting and one for an event.

                              3. Create a view called Department Calendar. Change the view style to calendar.

                              4. Create a view selection formula to select the documents created with the form "Schedule Event."

                              5. The events listed in the database span multiple days as well as specific time slots. Design the calendar to allow all the events to appear. The following graphic illustrates how the information will look in view design mode after all the formulas have been entered:



                              6. Customize the view to:

                              - Enable time slots
                              - Show bitmaps
                              - Set the time range from 8:00 am - 6:00 pm in 30 minute increments
                              - Specify a color to highlight busy rows


                              Back to Table of Contents


                              Create an Action Bar with New @Commands
                              The following exercise uses the new @Commands available for Calendaring and Scheduling.

                              Steps

                              1. Open the Department Schedule view in design mode. This is the view you created in the previous exercise.

                              2. Create an action bar for the view which will allow the staff in the department to change to the various calendar formats. Include the two-day, one-week, two- week, one-month, and current day format.

                              Back to Table of Contents


                              Solutions
                              An example of a Calendar view resides in the Department Schedule database (DeptSch.nsf). The view name is Department Calendar (Solution).

                              Back to Table of Contents

                            •     About IBM Privacy Contact