41 timer

This object executes actions at fixed times in intervals specified before. It is possible, for example, to start a process on a fixed day in the week, or to be reminded of certain dates (days, hours,…).

With the timer times can be specified in months, weeks, days, hours, minutes, and seconds. Intervals can also be defined in these units.

Definition

{ export | reexport } { model } timer { <Identifier> }
{
  <object-specific attributes>
}

Events

select

Children

document

record

transformer

Parent

dialog

module

Menu

none

41.1 Attributes

Attributes

RLD

PID

Properties

Short Description

.active

boolean

boolean

S,G/D/C

active state of object

.class

class

class

-,G/-/-

class/id of object

.count

integer

integer

S,G/D/-

repetition of timer

.dialog

identifier

instance

-,G/-/-

dialog to which the object belongs

.document[integer]

object

document

S,G/-/-

accesses the I-th XML Document

.external

boolean

boolean

-,G/-/-

returns if the object class is an USW class

.external[integer]

class

class

-,G/-/-

returns the I-th registered USW class

.firstrecord

object

record

S,G/-/C

accesses the first record of an object

.incrtime

string

string

S,G/D/C

intervals of timer

.label

string

string

S,G/D/C

name/identifier of object

.lastrecord

object

record

S,G/-/C

accesses the last record of an object

.model

identifier

instance

S,G/D/C

model belonging to object

.record[integer]

object

record

S,G/-/C

accesses the I-th record of an object

.recordcount

integer

integer

-,G/-/-

queries the number of child records

.scope

integer
(1, 2, 3)

scope

-,G/-/-

queries the object type (Default, Model or instance)

.starttime

string

string

S,G/D/C

specified time for timer

41.1.1 Definition of Time Spans

There are two possibilities for time definition:

Absolute Time Definition

{<hour>}:{<minute>}{:{<second>}}

{<day>}.{<month>}.{<year>} {<hour>}:{<minute>}{:{<second>}}

{<month>}/{<day>}/{<year>} {<hour>}:{<minute>}{:{<second>}}

{<DoW>} {<hour>}:{<minute>}{:{<second>}}

 

DoW: day of the week (1 = Monday, 2 = Tuesday, .... , 7 = Sunday)

Time Interval

+ {<hour>}:{<minute>}{:{<second>}}

+ n d

+ n D

+ n m

+ n M

+ n y

+ n Y

d, D:

days

m, M:

months

y, Y:

years

If no value is specified in the absolute time definition, the corresponding value will be taken from real time, i.e. "now".

If no seconds are specified, they will be set to 0 if : is missing, or to the seconds in real time if : is given.

Day numbers up to 31 are allowed for each month. If a month has less days, the last day specified will be considered the last day of that month.

Years can be specified in the range of 1901 to 2099. Alternatively, values from 0 to 99 are allowed, which will be mapped to the period 1970 to 2069.

Examples

Note

The attribute .starttime can be used for the absolute time definition or for the time interval.

The attribute .incrtime can be used for the time interval only.

41.2 Example

Use of a timer for an autosave function:

timer TiAutoSave { }

window WnAutoSave
{
  child checkbox CbAutoSave { }
  !! Timer is activated and deactivated with this checkbox.

  child edittext EtMin { }
  !! Includes the number of minutes after which the
  !! select event for the timer is to be sent.

  child edittext EtFileName { }
  !! Name of the file in which is to be stored.
}

on CbAutoSave select
{
  if CbAutoSave.active
  then
    CbAutoSave.text     := "yes";
    TiAutoSave.incrtime := (("+:" + EtMin.content) + ":");
    TiAutoSave.active   := true;
  else
    CbAutoSave.text   := "no";
    TiAutoSave.active := false;
  endif
}

on TiAutoSave select
{
  !! Rule R_SaveFile(EtFileName.content) is called at each
  !! select event.
}