Skip to main content
InSource Solutions

TN AG113 Building a Trend and Alarm Symbol - Part 2 - Adding DateTime Selection

insource logo large.jpg

 

Description

In this series we will create an ArchestrA Symbol which shows us Trend and Alarm information correlating the two sets of data with one another.  In this second article we will add the ability to customize the time and date range that we are viewing.
 

  • Author: Dillon Perera
  • Published: 12/30/2015
  • Applies to: InTouch 2014R2

 

This article is the second in a series:

Part 1: TN AG112 Building a Trend and Alarm Symbol - Part 1 - Linking the Data

Part 2: TN AG113 Building a Trend and Alarm Symbol - Part 2 - Adding DateTime Selection

 

Details

Note: Before beginning, you may want to create a backup of your symbol or application.

 

1. Open the TrendAndAlarmDisplay Symbol for editing, which we created in the Part1 article.

2. From the Tools, select the DateTimePicker and add it underneath the AlarmClient1 control, and name this element dtStartTime from the properties window. 

TrendAndAlarm-P2-NamedtStartTime.png

3. Duplicate the dtStartTime element and name the new copy dtEndTime and place it below dtStartTime.

TrendAndAlarm-P2-AddDateTimePickers2.png
 

4. Add labels beside each DateTimePicker.

TrendAndAlarm-P2-AlarmAndDateTimePickers2.png

 

5. Add a Custom Property called DefaultEndTime, of type Time.  This will be a Private property, with a Tag value set to Now().  This will be used to automatically set the End Time DateTimePicker to the current time.

TrendAndAlarm-P2-CustomProp_DefaultEndTime.png

 

6. Add a Custom Property called DefaultStartTime, of type Time.  This will be a Private property, with a Tag value set to DefaultEndTime.Add(-5).  This will be used to automatically set the Start Time DateTimePicker to the current time - 5 minutes.

 

7. Double click on the dtEndTime DateTimePicker, and in the Time Reference set this equal to DefaultEndTime.  In the Configuration Section set the Format to Custom, with a value of "MM/dd/yyyy h:mm tt".  Click OK.

TrendAndAlarm-P2-DateTimePickerFormat2.png

 

8. Double click on the dtStartTime DateTimePicker, and in the Time Reference set this equal to DefaultStartTime.  In the Configuration Section set the Format to Custom, with a value of "MM/dd/yyyy h:mm tt"

 

9. Add a button beside the DateTimePickers that says Update To Selected Time.

TrendAndAlarm-P2-AddUpdateTimeButton.png

 

10. Double click on the button and add an Action Script animation.  Enter the following script:

 

'Update the AlarmClient1 control to use the selected times
AlarmClient1.TimeSelector.SetStartAndEndTimes(dtStartTime.Value.ToString, dtEndTime.Value.ToString, 0);
AlarmClient1.Requery();

'Update the TrendClient1 control to use the selected times
TrendClient1.SetStartAndEndTimes(dtStartTime.Value, dtEndTime.Value,0);

TrendAndAlarm-P2-UpdateToSelTimeScript.png

 

 

11. Double click on the AlarmClient1 control, and on the Alarm Mode configuration uncheck the Update to Current Time option.

TrendAndAlarm-P2-TurnOffUpdateToCurrTime.png

 

12. Go to the Event configuration and reopen the Double Click script.  Add the following lines to the end of the script:

'Update the TrendClient1 control to use the selected times
TrendClient1.SetStartAndEndTimes(dtStartTime.Value, dtEndTime.Value,0);

TrendAndAlarm-P2-UpdateDoubleClickScript.png

 

13. Save your work, and test in Runtime.  You should now be able to select a specific Start and End time, then click the Update button to only show alarms from that time period.  If you double click on one of those alarms you will then see the trend information for that same period.

TrendAndAlarm-P2-Runtime.png