Examples of Scheduling Polled Triggers
You can schedule calculations using polled triggers, as shown in the following examples.
Scheduling a Trigger every Monday
Since Monday is the second day of a week, enter the following VBScript code in the Calculation pane:Dim curDate curDate=CurrentTime
IF (Weekday(curDate))=2 THEN
Result=50 <Place your calculation here>
END IF
Notice that the CurrentTime
built-in function is used in this
example instead of Now
.
Scheduling a Trigger on the First Day of Every Month
Enter the following VBScript code in the Calculation pane:Dim curDate curDate=CurrentTime
IF (day(curDate))=1 THEN
Result=50 <Place your calculation here>
END IF
Notice that the CurrentTime
built-in function is used in this
example instead of Now
.
Scheduling a Trigger on the Last Day of Every Month
Enter the following VBScript code in the Calculation pane:Dim curDate curDate=CurrentTime
IF (day(curDate))=1 THEN
Result=50 <Place your calculation here>
END IF
Notice that the CurrentTime
built-in function is used in this
example instead of Now
.
Example 5: Creating a Controlled Sequence of Polled Tags Using a Collection Offset
A controlled sequence is a calculation that is based on the result of another calculation. The following is an example of how to configure a controlled sequence of polled tags by using the collection offset. The collection offset is greater than 0 in this example.
A tag named SumOfData
has a Collection Interval of 60 seconds and the Collection Offset of 0 milliseconds.
SumofData
performs the first calculation:Result = CurrentValue("DataTag1") + CurrentValue("DataTag2")
Another tag, named CorrectedUnits
, uses a Collection Interval of 60 seconds, but a Collection Offset of 1000 milliseconds.
CorrectedUnits
fires and performs another calculation based on the output of the first calculation: Result = CurrentValue("SumOfData") *.0001