DayCal2.html
DayCal2 is part of Calendar Pack2 CalPack2.html , which comprises DayCal2, ResourceCal2 ResourceCal2.html , MonthCal2 and NavCal.
The DayCal2 function gives you access to a rich Drag-n-drop calendar, and allows a huge variety of customizations to get the calendar working in your database, just how you want it.
DayCal2( displayStartDate ; displayNumDays ; "dateFieldName" ; "startTimeFieldName" ; "durationFieldName" ; {;"descriptionFieldName" ; "colorFieldName"; "titleFieldName" ; "actionOnApptSelect" ; "actionOnApptEnter; "actionOnDaySelect" } )
Parameters
| Parameter Name | Decsription |
1 | displayStartDate | The first date to show on the calendar. Can be a date in quotes or the name of a field (on either the parent or the child table) containing the date, or a calculation producing a date. If a field name is used, it is NOT enclosed in quotes. If left blank, and displayNumDays is left at 0, the first date displayed will be today's date. |
2 | displayNumDays | The number of days to show. The width of each day shown is fixed, so you will see as many days as will fit in the Web Viewer you’ve drawn. Can be a number or the name of a field (on either the parent or the child table) containing the number of days, or a calculation producing a number. If a field name is used, it is NOT enclosed in quotes. |
3 | "dateFieldName" | The field on the child (appointment) table containing the appointment date. Must be of type Date. The field name needs to be enclosed in quotes and be the full TO::FieldName form. Note that the field name parameters should not be calc fields if you want to be able to update records. |
4 | "startTimeFieldName" | The field on the appointment table containing the Start Time of the appointment. Must be of type Time. The field name needs to be the full name and enclosed in quotes. |
5 | "durationFieldName" | The field on the appointment table containing the Duration of the appointment. The field name needs to be the full name and enclosed in quotes. As an alternative to duration, you can use the 'EndDateFieldName' override to set an end timestamp field. This makes the calendar search for records much quicker and is recommended where possible, especially for databases with larger record sets. In this case, you can simply leave durationFieldName blank. |
6 | "descriptionFieldName" | The field on the appointment table containing the Description of the appointment. The field name needs to be the full name and enclosed in quotes. |
7 | "colorFieldname" | The field on the appointment table containing the Color to be used for the appointment. The field name needs to be the full name and enclosed in quotes. Three formats are recognized: hex e.g. #00ffff (no spaces) or RGB() e.g. RGB(200,0,0) or common color names recognized by all browsers: see http://www.w3schools.com/html/html_colornames.asp |
8 | "titleFieldName" | The field on the appointment table containing the Title to be used as the top line of the appointment. The field name needs to be the full name and enclosed in quotes. |
9 | actionOnApptSelect | The name of the script or a command to run on selection of an appointment. (useful for obtaining the record number of the record currently being edited). See Action Parameters below. |
10 | actionOnApptEnter | The name of the script or a command to run on entry into an appointment. See Action Parameters below. |
11 | actionOnDaySelect | The name of the script or a command to run on selection of a day. No script parameter should be used in this case: a script parameter set to the date selected, in format yyyy-mm-dd, is automatically generated. See Action Parameters below. |
Example
DayCal2(
// The Start Date
DAYCAL_INTERFACE::Calendar DateStart g ;
DAYCAL_INTERFACE::Calendar Duration c ;
// Field Names
"DayCal_Interface to Appointments for WV::Start Timestamp" ;
"DayCal_Interface to Appointments for WV::Start Timestamp" ;
"DayCal_Interface to Appointments for WV::Duration" ;
"DayCal_Interface to Appointments for WV::Description c" ;
"DayCal_Interface to Appointments for WV::c Colour Hex" ;
"DayCal_Interface to Appointments for WV::Title"
)
Record Creation
The calendar makes use of Record creation by way of Drag-n-Drop, OR Double-Click (via override). In order make this a seamless experience, we need to use a field to store a temporary ID so that we can find the newly created record. By default, the calendar uses the "Description" field, however if you create a field named "zCreationID" on your appointments table, the calendar will automatically use that instead.
Action Parameters
Each of the functions in the Calendar Pack have optional Action parameters, allowing you to run a script or set a field when a field is selected. See Action Parameters for details.
To have the calendar remember (and automatically highlight) the previously selected appointment across reloads, record, and layout changes, you must use the 'SetField' action type for 'ActionOnApptSelect'. See the Action Parameters documentation for more information.
Multi-Line Keys in Calendars
Using a multi-line key on the left side of the relationship (the layout table) is possible, if you want to filter records that way. There are a few 'gotchas' which are explained on the CalPack2 documentation page.
Customization
It's possible to customize the look, layout and behaviour of many aspects of this Black Box by means of built-in "overrides", which are JavaScript and CSS functions. This is powerful but advanced stuff, and will make most sense if you're familiar with those technologies somewhat to begin with. If you don't want to tackle this yourself, but want it done, contact us - we're happy to be contracted to do this work.
To find out what functional overrides are available, you need to use Override Inspector. To make style and layout changes, use CSS Overrides. The best way to determine what CSS overrides are available is to open the Reactor debugger and click the CSS tab. See CSS Overrides and Customizing Calendar Display for further info.
With some knowledge of Javascript and CSS, you can quickly customize the following... and more!
position of the time panel
width of the time panel.
position of the date panel
time range
definition of non-working days or hours.
actions allowed and disallowed on appointments e.g. ability to create, edit, delete, scroll appointments, resulting in optional read-only calendar.
performing an action after creating an appointment
performing an action after deleting an appointment
performing an action after selecting a day
filtering of displayed appointments
For date formats used in Overrides, see Date Formatting.
See Relationship Structures for limitations on relationships you can use.
In order to make use of the automatic/multi-user update functionality, you'll need to make use of the zMODid field.