Skip to end of metadata
Go to start of metadata

Some of the advanced template features in the Designer are: changing Template Path using Template Repeater and Cloud Templates.

 

Changing Template Path

An instance of a template on a window has a property called Template Path. You can change this property on a window dynamically, and it can be bound to anything that produces a valid template path.

For example, if there are two tank templates in a folder called Tanks, one template is called Tank A and the other is called Tank B. Each tank has a different look, but they have the same Custom properties. Their respective template paths are Tanks/Tank A and Tanks/Tank B. The template rendered on a window can swap between Tank A and Tank B by binding the template's property to any string reference that says Tanks/Tank A or Tanks/Tank B.


IULocgo


Changing Template Path

 

Accessing Components Inside a Template Instance

When working with a Template Instance, the components inside that instance or normally hidden, and otherwise inaccessible. However, you can access these components via scripting. It helps to think of Template Instances as multi-layer containers. In most cases, users interact with only the Outer Layer, which contains the Template parameters, and the other default Template Instance properties. A Python script can access the Inner Layer, which then provides access to the components within. 

A script can traverse to the Inner Layer from the Outer Layer with a getComponent call. 

Pseudocode - Acessing the Inner Layer
myTemplate = event.source.parent.getComponent('MyTemplate')

# The '0' in the first getComponent call effectively refers to an index value of a component, which happens to be the Inner Layer. 
myTemplate.getComponent(0)

From the Inner Layer, a script can then call  getComponent again to access any components within. Assuming a Template with a Label component named "Label", we could access the Text property with the following:

Pseudocode - Accessing a Component From the Outer Layer
myTemplate = event.source.parent.getComponent('MyTemplate')

print myTemplate.getComponent(0).getComponent('Label').text


Template Repeater

The Template Repeater component lets you easily create multiple instances of a master template for display on the HMI. Each instance shown in the Template Repeater has the same look, feel, and functionality of the master template. The instances can be arranged vertically, horizontally, or in a "flow" layout, which can either be top-to-bottom or left-to-right. If there are too many instances to fit, a scrollbar is added to the display.

Additional information on the Template Repeater can be found on the Template Repeater Component page in the appendix.


IULocgo


Template Repeater

 

Cloud Templates

Cloud Templates is a free online repository of templates hosted by Inductive Automation. You can share your templates publicly or store them privately as well as browse the library of templates to help get your project off the ground faster.

Importing Cloud Templates

Cloud Templates give the Ignition community access to pre-built templates and allows users to share their own templates. Using Cloud templates, an Ignition developer can store templates for private use or public access outside the local Gateway, and make the templates available from any Designer regardless of the project or Gateway.

Because the templates are accessible from any Designer, there is no longer the need to manually port the templates from Gateway to Gateway.

The Cloud templates are entirely customizable after you import them from the Cloud. And unlike other Ignition templates, changes to the templates in the Cloud do not affect those template instances previously downloaded. Note that the public Cloud Templates are all free to use.

 


IULocgo


Cloud Templates

Let’s import a template from the Cloud.

  1. From the Project Browser expand Project.
     
  2. Right-click on Templates and select Cloud Templates Browser from the popup menu.


     
    The Cloud Templates Browser is displayed.

    The list of categories of Cloud templates for download are located on the left of the browser. This list is divided into Private and Public templates. The Public templates are displayed by default, but to see your Private templates, you must sign in with your Inductive Automation account.

     


     
  3. Select Alarms from the Public list.
    All publicly available templates for the Alarms category are displayed along with a description for the selected template.
     

  4. Select the Alarm Indicator template and click Import Template.

    A new popup appears allowing you to confirm import on the template.
     

  5. Click Import to confirm importing the template.


     
     

    The template is now imported and available for use within the Templates section of your Project Browser. You can drag your new template on a window or modify it however you like!


     

 


 

  • No labels