Adding Tag Bindings to Components Through a Script

If I'm correct in my assumption, consider the following approach:

Create a single template called something along the lines of AnalogCardPoint or similar. Create a parameter called baseTagPath and index. Create a custom property called tagValue. Create an indirect tag binding on tagValue that looks something like {1}/{2}/Data. In the box below the indirection string {1} should be linked to baseTagPath and {2} should be linked to Index

You can then take this template and use it in a template repeater. Create 2 custom properties on the template repeater called baseTagPath and pointCount. Create a property change script that has a first line that checks if event.source.propertyName == "baseTagPath" or event.source.propertyName == "pointCount". If it does match, build a template paramters dataset with a row count that matches the value of pointCount, and place this dataset into the templateParameters property of the template repeater.

Technically you could make this template repeater into a template as well, and have baseTagPath as a template parameter.

From there, just place enough copies of the template repeater as there are I/O modules and adjust the baseTagPath and pointCount properties for each to match the respective card.

1 Like