Show / Hide Table of Contents

Class AppointmentSlicer

Slices appointments into single entities that are within a single day. This class is essential when having calender data (with entries possibly spanning several days), which you would like to display in the calender control (which only accepts data for single days).

Syntax

Constructors

AppointmentSlicer()

Default constructor.

Declaration
AppointmentSlicer
Examples
AppointmentSlicer a;

a.addAppointment(1, DateTime(2017, 4, 23, 8, 0, 0), DateTime(2017, 4, 23, 10, 30, 0), "Meeting");

Methods

addAppointment(Integer,DateTime,DateTime,String)

Adds an appointment to the class.

Declaration
addAppointment(Integer id, DateTime start, DateTime end, String title)
Parameters
Type Name Description
Integer id

The ID of the appointment (can be retrieved later).

DateTime title

The title of the appointment.

DateTime start

When the appointment starts.

String stop

When the appointment ends.

Returns
Type Description

clear()

Clears all the added appointments from the instance.

Declaration
Void clear()
Returns
Type Description

eof()

Returns true if the internal iterator is past the appointments for the chosen day; otherwise, false.

Declaration
Bool eof()
Returns
Type Description
Bool

True if the internal iterator is past the appointments for the chosen day; otherwise, false.

getLoadForDay(Date,Time,Time,Integer)

Returns the accumulated load for a given day.

Declaration
Integer getLoadForDay(Date day, Time start, Time stop, Integer max)
Parameters
Type Name Description
Date day

The day to get the load for.

Time start

When to start calculating.

Time stop

When to stop calculating.

Integer max

The maximum time returned.

Returns
Type Description
Integer

The calculated load for the given day.

Remarks

The load is calculated by adding all the appointments for that day, cutting them at the start and stop times. Finally, the value returned is never more than max (unless max is -1, in which case there is no limit).

The start and stop limits are useful because it can be used to eliminate private appointments in the evening.

The max is good, because one normally never works more than 8 hours pr. day :)

getValue(String)

Returns the value for the given field for the appointment pointed to by the internal iterator.

Declaration
String getValue(String field)
Parameters
Type Name Description
String field

The field to get the value for.

Returns
Type Description
String

The value for the given field for the appointment pointed to by the internal iterator.

Remarks

Available fields: id, date, start, stop, stop, title

next()

Moves the internal iterator to next appointment in the same day.

Returns false if eof(); otherwise, true.
Declaration
next()
Returns
Type Description
Bool

False if eof(); otherwise, true.

setActiveDate(Date)

Sets the internal iterator to the given date.

Declaration
Void SetActiveDate(Date date)
Parameters
Type Name Description
Date date

The date to set the internal iterator to.

Returns
Type Description
In This Article
  • Constructors
    • AppointmentSlicer()
  • Methods
    • addAppointment(Integer,DateTime,DateTime,String)
    • clear()
    • eof()
    • getLoadForDay(Date,Time,Time,Integer)
    • getValue(String)
    • next()
    • setActiveDate(Date)
© SuperOffice. All rights reserved.
SuperOffice |  Community |  Release Notes |  Privacy |  Site feedback |  Search Docs |  About Docs |  Contribute |  Back to top