Getting Started: Dynamic References
What Does This Article Cover?
- What is a Dynamic Reference?
- Dynamic Reference considerations
- Dynamic Reference examples
- Other related material
What is a Dynamic Reference?
Dynamic Referencing is a technique used to parameterize Intelligence Hub component objects. Dynamic references are supported on text-based input fields for many component objects, including Connection Inputs and Outputs. Connections and System Variables are also examples of inputs that may be dynamically referenced. The syntax for a dynamic reference is surrounding the respective text field input with a pair of curly brackets. This is an example of a dynamic reference.
SELECT * FROM machineTable WHERE machineID={{Connection.opc.machineIDTag}}
Dynamic Reference Considerations
When using Dynamic References consider the following:
- The range of values of the referenced data. For example, what will happen if the value is null?
- The data type of the referenced data. For example, what is the impact of possible numeric data type mismatches?
Dynamic referencing is a powerful technique that enables a solution to scale within an Intelligence Hub and across many Intelligence Hubs. The following are examples of dynamic references.
Example: A Dynamic Reference in a Connection Input
A Dynamic Reference may be used in a Connection Input. In this example, a System Variable defined for the Intelligence Hub is being used in a Where clause for a SQL Query. This would allow the configuration to Sync to a different Intelligence Hub with a different value for the same System Variable, yielding a different result for the query.
SELECT [dbo].[Enterprise_Asset_Hierarchy].[Kepware_Path] FROM [dbo].[Enterprise_Asset_Hierarchy] WHERE [dbo].[Enterprise_Asset_Hierarchy].[Kepware_Server] = '{{System.Variables.KEPServerEX}}'
``
Example: A Dynamic Reference in a Connection Output
A Dynamic Reference may be used in a Connection Output. It may be beneficial for Output settings to be variable based on the data being sent. For example, the MQTT Output topic may be set based on the attribute values in the payload. Here the payload contains the asset hierarchy that is used for the MQTT topics.
Status/{{this.Enterprise}}/{{this.Site}}/{{this.Line}}/{{this.Cell}}/{{this.Asset_Name}}
``
Example: A Dynamic Reference in an Instance
A Dynamic Reference may be used in an Instance's Attribute mapping. In this example an Attribute value from the Instance's Dynamic Template is being passed to the Connection Input. This allows the Attribute value to vary per Instance.
{{Connection.HB_PI_System.Input_PI_Asset_All_Boilers_Data(ID={{this.ID}})}}[0].Burner