Skip to end of metadata
Go to start of metadata


A Tag binding is a straight-forward binding type. It simply binds a property directly to a Tag Property (typically the value). This sets up a subscription for that Tag. Every time the chosen Tag changes, the binding is evaluated and pushes the new value into the bound property. If you choose a Tag in the tree, and not a specific property of that Tag, the Value property is assumed.  

Tag Binding Interface

There are three different types of tag bindings in Perspective, but they all share some common interface elements. 

Mode Selection

Allows the binding to switch between the different tag binding modes, which are described further down this page. 

Options

The following options are available, regardless of mode:

OptionDescription
EnabledDetermines if the binding is enabled. Unchecking this option will prevent the binding from executing. Useful in cases where the binding needs to be temporarily disabled. 
Overlay Opt-OutIf the target of the binding returns a non-good quality code, this setting indicates whether the component should reflect the quality code with a component overlay.
Publish Initial Uncertain Value

The following feature is new in Ignition version 8.1.8
Click here to check out the other new features

Which switching to the view where this binding is located, the binding is briefly provided an initial value of "null" with a quality code of Uncertain_InitialValue. Because this quality code is not good, the component will show a quality overlay. Once the most recent value of the target tag has been received, the binding will replace the null value with the newly received value, and remove the quality overlay.

If checked, this setting will cause the binding to ignore this initial null value. This prevents the quality overlay from appearing due to the initial null value. All other overlays will function normally. 

BidirectionalDetermines if this binding should be allowed to write back to the target. Defaults to unchecked, meaning that the binding will only ever read the target's value. If checked, then changes made to the bound property will cause the binding to send a write request to the target of the binding.  
Fallback DelayWhen a value is manually written to the bound property, a write request will be sent to the target (assuming Bidirectional is checked). If the binding doesn't receive confirmation that the write request was accepted, the value on the bound property will instead fallback to the value on the target. This option determines the number of seconds until the binding value falls back. 

Drag and Drop

Ignition automatically creates the Tag bindings to several of the component properties  when you choose to bind a Tag to a component by dragging and dropping. This is true for both creating a component by dragging and dropping a Tag onto empty space in a container, and by dragging and dropping a  dropping a Tag directly onto a component property

You can drag a Tag onto a container. Perspective will give you an option for the kind of component you'd like to use to represent the Tag. Configuration options for Tag drop are set in the Project properties. For more information, see Tag dropConfigIn this example we drag the Tag for a tank onto a view and choose the Cylindrical Tank option.




On this page ...

IULocgo


Tag Drop

A Cylindrical Tank component is placed on the view. Notice that the value for the component and the value for the Tag match. The component's displayed value will update as the Tag updates. 



Direct Tag Binding Mode

A direct binding binds a component property to a Tag path. Every time the  Tag's value  changes, the binding is evaluated and the new value is sent to the bound  property In the example below, the value of the Active_Tank Tag is displayed as a percentage of the capacity of the Cylindrical Tank component. 




IULocgo


Tag Binding


Indirect Tag Binding Mode

An Indirect  Tag  binding is very much like a standard  Tag  binding, except that you may introduce any number of indirection parameters to build a  Tag  path dynamically in the session.  These parameters are numbered starting at one, and denoted by braces, for example, {1}. The binding will be linked to the Tag represented by the Tag path after the indirection parameters have been replaced by the literal values they are bound to.

For example, instead of binding directly to the FlowRate Tag inside the Valve4 folder, as show in the following example:



You can build an indirect Tag path that will point to the FlowRate Tag for all valves between Valve0 to ValveN where N is any valve number. Below, the valve number is replaced by {1} where {1} is a placeholder for a dynamic reference that will be used to create a single Tag path capable of referencing every FlowRate Tag inside every existing Valve:



The {1} dynamic Reference must be pointed to a Property. Your property can pointed to any component property value or Tag value to build an Indirect Tag Binding. In the capture above, the {1} dynamic reference is pointing to a view custom property named valveNumber which is used to help users control which Valve the binding is reading a FlowRate from.

Indirect Tag Binding - Bidirectional

Indirect Tag Bindings can also be made Bidirectional by clicking the Bidirectional checkbox on the Edit Binding screen. This will allow any input from a user on that property to be written back to the Tag. To work properly, the Tag needs to have the proper security to accept writes.

IULocgo


Indirect Tag Binding



Indirect Tag Binding Example

 Click here for Indirect Tag Binding example

In this example, we have some different motors, where each motor is a folder of Tags. Each motor has an amps Tag that is within the folder, so that our Tag paths look like the following:

Motors/Motor  1 /a mps
Motors/Motor  2 /a mps
Motors/Motor  3 /a mps
Motors/Motor  4 /a mps


Instead of creating four different displays for these four different Tags, we can create a single display and make it indirect. We need two things for this example: A component to display the value in, and a component which allows the user to select which motor they are looking at.

  1. Drag an LED Display component onto the view. This will be the display component.
  2. Drag a Dropdown component onto the view. This will be used to allow the user to choose what motor the LED Display is showing amps for.
  3. Select the Dropdown component. In the Property editor, under the options property, click Add Array Element...



  4. Set the value to 1 and the label to Motor 1. 
  5. Repeat steps 3 and 4 to add array elements for Motors 2, 3, and 4.   



  6. Click on the LED Display component. Select the Binding   icon in the value property. 
  7. Click on the Tag binding type then click the Indirect button.
  8. Click the Tag  icon and scroll down to the Motors/Motor 1/Amps Tag. Click OK.

  9. In the Tag Path field, replace the 1 with {1}. We are replacing "[default]Motors/Motor 1/Amps" with "[default]Motors/Motor {1}/Amps" maintaining the space found between "Motor" and "1" in "Motor" and "{1}".



  10. In the References list, select the row. Click the Properties   icon. 
  11. Scroll to the Dropdown component and select the value  property of the Dropdown. Click OK.


    What we have done is configured the Dropdown component's value property to be inserted into our indirect Tag path in place of "{1}". If we select "Motor 1" from the Dropdown component, its value property then becomes 1. The number 1 then takes the place of "{1}" in the indirect Tag path making it "[default]Motors/Motor 1/Amps". Similarly, selecting "Motor 2" from the Dropdown component makes its value property be 2. The number 2 then takes the place of "{1}" in the indirect Tag path making it "[default]Motors/Motor 2/Amps".

  12. Click OK to save the binding.
  13. Put the Designer into Preview mode   to see the components and the indirect in action. 
  14. Select a motor in the Dropdown component. The value in the LED Display component will change depending on the Motor that is selected in the Dropdown list.


Tag Expression Binding

The Tag Expression binding uses the Expression language to specify an entire Tag path. This mode allows the bound property (Tag) to be bidirectional. The Tag path in the Expression is expected to be a string. Note that is different and not to be confused with an Expression Binding.  


IULocgo


Tag Binding - Expression

Tag Expression Binding - Example

 Click here for Tag Expression Binding example

For this example, we start with two Tags: Tag A and Tag B and two buttons on a view.



  1. Right click on the first button and select Configure Events.
  2. Select onClick
  3. Under Organize Actions, click the Add  icon and select Popup
  4. Under Parameters, click the  Add   icon to add a new  parameter.
  5. Enter "tagToShow" in the Name field and "Tag  A" in the Value field. Click  OK



  6. Repeat steps 1 through 4 for the second button, but in the Value field, enter Tag B .



  7. Create a new view named Popup.



  8. Drag a Label component and a Text Field component onto the Popup view. 
  9. In the Popup view, click on Add View ParameterA.
  10. Add a new parameter, tagToShow.



  11. Select the Label component. Click on the Binding  icon next to the text property.
  12. On the Edit Binding screen, select the Property binding type. Enter view.params.tagToShow in the Configure Property Binding field.
  13. Click OK.



  14. Next set a binding on the Text Field component. Select the component then click on the Binding  icon next to the text property.
  15. On the Edit Binding screen, select the Tag binding type and select the Expression button.
  16. Enter the following expression. This expression in the example tells the Text Field to display the value of Tag A if the view parameter is equal to Tag A. Otherwise display the value of Tag B.

    if(
        {view.params.tagToShow} = "Tag A",
        "Z_Other_Tags/Tag A",
        "Z_Other_Tags/Tag B")





  17. Click OK to save. 
  18. Put the Designer into Preview mode  . When you click on the Open with Tag B button, the popup appears as shown below.



     



In This Section ...


  • No labels