TN - 1197 Using a Namespace to Assign Pens to the HistoricalTrend App
Description
This article from InSource shows assign pens to the HistoricalTrend App in runtime using an OMI namespace.
- Author: Justin Benton
- Published: 11/30/2021
- Applies to: Intouch OMI 2020 and Above
Details
One strategy in order to assign pens to the HistoricalTrend App is to create a Namespace in order to write to it. The Namespace will then be called from the Pens property within the HistoricalTrend App. Here are a couple of examples.
Using a Button
- Create a Namespace and add a string attribute. We'll call it "Pentest1"
- Create a symbol and add a button. Add it to a pane in your layout. Configure the button.
Your entire string should resolve on its own. In this example, "Time_001" is my UDO name and "Attribute001" is the attribute set to historize.
- In the properties of the HistoricalTrend App, search for "Pens" and add MyviewApp.namespace.pentest1. Set the tag type to "In"
- Deploy all necessary components and launch your viewapp. Pressing the button will add a pen to your app.
On Show
- Create a Namespace as shown in the previous example.
- Select the "Scripts" option in your layout, and create an OnShow script.
- In the properties of the HistoricalTrend App, search for "Pens" and add MyviewApp.namespace.pentest1. Set the tag type to "In"
This way scripts the layout to immediately write to the Namespace when the app is shown. You can add multiple attributes using a comma.