You're currently browsing the Ignition 8.0 docs. Click here to view the latest docs.


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.  

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 on a window at the same time Ignition prompts you for what type of component you want to create, and by dragging and dropping a dropping a Tag directly onto a component that already exists on a window. In both cases, Ignition automatically creates the Tag bindings on the component. 

You can drag a Tag onto a container or view. 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

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 propertyIn 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

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 tagpath 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

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/amps
Motors/Motor 2/amps
Motors/Motor 3/amps
Motors/Motor 4/amps


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

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.



     





  • No labels