Description
The TimeRangeDefinition allows you to create custom time ranges that can be used in Active tools (dynamic report generation, history export, etc.). A TimeRangeDefinition is created from the TimeRangeDefinitionFolder of the BtibService and becomes accessible in all properties of Active objects that use a time period.
(warning) The TimeRangeDefinition is used to define a "structure", a schema that allows a time period to be built. The time period is not saved as it is, if a TimeRangeDefinition defines a period of one month from "now", then the period will be recreated each time it is called and the "now" is not set when the TimeRangeDefinition is created.
Implementation
Creating a TimeRangeDefinition
Creating a TimeRangeDefinition involves four steps:
-
Definition of a reference date
This is one of the two extremes of the period; it can be the start date or the end date (depending on the direction defined, see more below).
|
Reference date |
Additional parameter |
Meaning |
|---|---|---|
|
Now |
- |
One of the extremes will be the moment the period is called |
|
Beginning Of / End Of |
Minute / Hour / Day / Week / Month / Year |
The beginning or the end of the current month (1st at midnight), the current day (midnight), the year (midnight January 1st), etc. |
|
Last / Next |
Custom Schedule |
Displays the lists of a CustomSchedule. Four lists are then available:
Allows you to select the last (or next) Wednesday of June for example, or the last September 1st.
(warning) The date sought must not be more than 3 years before or after the current date. |
|
Fixed |
Date |
A fixed date (i.e. not relative to when the period is called) |
|
None |
- |
The time range will start at the beginning of the history |
-
Definition of an offset
Allows the reference date defined previously to be offset. Not available when the reference date is "none".
|
Offset |
Number of times the period must be offset |
|---|---|
|
None |
- |
|
Minute / Hour / Day / Week / Month / Year |
Positive or negative number:
|
-
Definition of a duration
Sets the duration of the period from the reference date defined in the first two steps.
|
Additional parameter |
Duration |
Meaning |
|---|---|---|
|
- |
To Now |
The time range runs from the reference date to "now" (i.e. the moment the period is called) |
|
Number of items to add to define the duration. Cannot be negative |
Minute / Hour / Day / Week / Month / Year |
The duration of the time range is fixed; it will always count the same number of items (5 minutes, 8 hours, 10 days, etc.). |
|
- |
To End Of History |
The time range is from the reference date to the end of the history. |
-
Definition of a direction
Defines in which direction the duration will be applied in relation to the reference date. Not available when the duration has been set to "toNow" or "toEndOfHistory".
|
Direction |
Meaning |
|---|---|
|
Forward / Backward |
|
Example:
Reference date: November 1st and duration: 1 month.
-
Direction: forward, the time range will be from November 1st to December 1st
-
Direction: backward, the time range will be from October 1st to November 1st (in this case, the date of reference becomes the end date of the period).
Selecting a TimeRangeDefinition
The created time ranges can then be called from most B.tib objects that need to define a period. For all these objects, the selection of the time range is as follows:
A drop-down list shows all the time ranges created from the TimeRangeDefinition defined by name. In addition, the list offers the option "Duration", which allows direct definition of a fixed period.