Start Specification Timer
The Start Specification Timer Task will start a Specification Timer to periodically run a Macro based on the
Interval, Count and Macro Name Properties.
A Specification Timer will trigger a named Specification Macro each interval until one of the following
occurs;
- The Count is reached
- The Cancel Specification Timer task is used
- The Specification is Transitioned away from a Running State
Specification Timers only function in Running States.
Specification Timeout in the Integration Theme
The length of time that a specification is allowed to remain inactive before it is timed out (closed) can be set in the Integration Theme.
When this Task is used, on a running Specification in the Integration Theme, and the specificationTimeout is triggered before the timer has finished, the Task will be cancelled.
Properties
Property Name | Description |
---|
Timer Name | The name to give to the Timer being started. If left blank, the Timer will be called “Default”.
|
Interval | The interval in seconds of how often the Macro should run. |
Count | The number of times the Macro should be run. To continually run the timer until it is canceled,
set this to 0. |
Stay On Schedule | If TRUE, the timer will not be halted during Macro execution meaning that if execution carries
on into the next interval of the Timer, that interval will be skipped. If FALSE, the Timer will
be paused during Macro execution and resumed upon completion, meaning every interval is
respected. |
Macro Name | The name of the Macro in the Project. |
Macro Argument | Provides an optional argument to the Macro. Click here for more information...The Macro Argument property provides an optional argument to the
macro. Property Type:
Static Default Value: null The value or result of a rule, placed in the Macro Argument
property, is passed into the special variable
Current Macro Argument (see
Info: Special
Variables). Using the Macro Argument property allows the same macro to be
used, but with differing outcomes depending on when it is run. To Change the Default ValueEnsure the property is a static property (It will display the
gray orb
alongside the
property name) The default value of the static property can be changed by typing the required value directly into the property field: - Click in the property field for Macro Argument
property.
- Type the required value directly into the property field.
ExamplesMacro Argument Value (Static) | Result | Notes |
---|
1 | Will pass the value
1 into the special variable Current Macro
Argument. | |
A rule can also be built for this property by changing the type to dynamic. See How To: Change A Static Property To A Dynamic Property. Macro Argument Value (Dynamic) | Result | Notes |
---|
"Type A" | Will pass the text
Type A into the special variable Current Macro
Argument. | | DWVariableTotal * QtyReturn | Will pass the result of
DWVariableTotal multiplied by QtyReturninto the special variable
Current Macro Argument. | The Macro Argument property is required to be dynamic to create
the rule. |
Value set in Form Designer. Static
properties can be made Dynamic by double clicking the gray radio
button. |
Counter Constant | Optional. The name of a Constant which will receive the Counter value of the Timer on each
iteration. |
Concept
Stay On Schedule
The Stay On Schedule property has the most impact in situations where the time taken to execute the Macro is
either longer than or a significant proportion of the Timer Interval.
The following scenarios demonstrate the effect of the Stay On Schedule Property.
Scenario 1
Property Name | Description |
---|
Interval | 2 |
Count | 3 |
Stay On Schedule | FALSE |
Execution of the macro takes 4 seconds.
Timer is started at 12:00:00
The first Macro will be triggered at 12:00:02 (Start time + Interval)
The Specification Timer will be paused until completion of the Macro at 12:00:06
The macro will be triggered for a second time after another 2 second Interval, at 12:00:08
As before the Specification Timer will be paused until completion of the Macro at 12:00:12
The Macro will be triggered for a third time after another 2 second interval, at 12:00:14
Third Macro completed at 12:00:18
The Specification Timer has reached the Count Property value and will stop, all Macros have been completed by
12:00:18
In this scenario the macro is triggered three times, and the Specification Timer will be paused whilst each
Macro is completed. The Specification Timer will only continue to tick after the Macro is completed, meaning
this Specification Timer is NOT on schedule.
Scenario 2
Property Name | Description |
---|
Interval | 2 |
Count | 3 |
Stay On Schedule | TRUE |
Execution of the Macro takes 4 seconds.
Timer is started at 12:00:00
The first Macro will be triggered at 12:00:02 (Start time + Interval)
The Specification Timer will continue whilst the Macro is executed.
The Specification Timer will tick at 12:00:04 (Start time + 2 Intervals), but the Macro cannot be triggered
as the first Macro is still being completed.
The Specification Timer will tick again at 12:00:06 (Start time + 3 Intervals), the first Macro will now be
complete, enabling a second Macro to be triggered.
Second Macro completed at 12:00:10
The Specification Timer has reached the Count Property value and has stopped, two Macro executions have been
completed by 12:00:10
In this scenario the Macro is triggered twice, and the Specification Timer will continue to tick every two
seconds whilst each Macro is running. A Macro will only be triggered when no Macro is running. In this
scenario the Specification Timer is constantly ticking, meaning this Specification Timer IS
on schedule.
The effect of the Stay On Schedule Property is summarized in the following table.
Summary | Scenario 1 | Scenario 2 |
---|
Stay On Schedule Property | FALSE | TRUE |
Number of Macro Executions | 3 | 2 |
Timer lifespan (seconds) | 18 | 10 |
Restarting Specification Timers
If the Start Specification Timer Task is run while a Specification Timer of the same name is already running,
the currently running Specification Timer will be stopped and a new instance of the Specification Timer will
start.
To run multiple Specification Timers simultaneously each Specification Timer will need a
unique name in the Timer Name Property.
Examples
When this task is added the properties are static by default. See How To: Change
A Static Property To A Dynamic Property to enable rules to be built on these properties.
Start a Specification Timer to toggle between images displayed on a Form
The Specification Timer started by this Task will run a Specification Macro every 10 seconds continually. The
Specification Macro will toggle between two images displayed on a DriveWorks Form.
Property Name | Example Rule | Example Result | Meaning |
---|
Timer Name | "Image Toggle" | Image Toggle | The name given to the Specification Timer. This name can be used in the Cancel Specification
Timer Task to cancel this Specification Timer. |
Interval | 10 | 10 | The 'ChangeImage' Macro will be ran every 10 seconds. |
Count | 0 | 0 | The Specification Timer will be run continually. |
Stay On Schedule | FALSE | FALSE | The Specification Timer will be paused during Macro execution. |
Macro Name | "ChangeImage" | ChangeImage | This is the name of the Specification Macro that will be ran each interval. |
Refresh SQL Data periodically during a Specification
If you have multiple users updating SQL data simultaneously you may wish to make sure that any updates are
included in all currently running Specifications. Specification Timers can be used to do this.
Repeatedly running large SQL queries can negatively impact Project performance.
Property Name | Example Rule | Example Result | Meaning |
---|
Timer Name | "Refresh SQL Data" | Refresh SQL Data | The name given to the Specification Timer. This name can be used in the Cancel Specification
Timer Task to cancel this Specification Timer. |
|
Interval | 60 | 60 | The 'QueryData' Macro will be ran every 60 seconds. | Count | 0 | 0 | The Specification Timer will be run continually. |
Stay On Schedule | TRUE | TRUE | The Specification Timer will continue during Macro execution. |
Macro Name | "QueryData" | QueryData | This is the name of the Specification Macro that will be ran each interval. |
Counter Constant | "DWConstantDataUpdateCount" | DWConstantDataUpdateCount | The number of times the Specification Timer has ticked is stored in this Constant. This value
can be used elsewhere in the Project. |
Using the Task in a Specification Macro
This task has different types of Outputs. For more information about Outputs see Specification Macros Task Node.
Outputs are only available within Specification Macros. Currently Outputs are not available for
Specification Flow.
Status Outputs
This task supports Status Outputs. These can be used to perform different actions depending on what the
status
outcome of the task is. For more information see Status Outputs in the Task
Node
Outputs section of Specification Macros Task Node.
The status output navigation is as follows:
Success
- Successfully executed task.
Success with Warnings
Failed (one of the following occurred)
- No Macro name provided.
- Constant could not be found.
- General error - see Specification Report for more information.