I'm trying to build a template of a Template Repeater (TR) that will be capable of populating itself with repeatable templates for each instance of a UDT in a folder. For example, I have a path structure like:
[HMI]
deviceA
instance_1
instance_2
instance_3
instance_4
...
To feed this Template Repeater Template (TRT), I would need to give it the tagFolderPath (e.g. [HMI]deviceA
), and something like tagName (instance
). I haven't figured out yet how to count the number of tags in a folder dynamically, but even if I had to set the count, and follow a generic naming structure, it would be very helpful to have this TRT. But I can't figure out how to combine "Count" mode with a dynamic naming scheme for the templates being inserted into the TRT!
I think I want the TR that can pass more than just the "Index Parameter" while in "Count" mode. But for the life of me, I can't find a way to do that! I don't want to have to make templates that are so hardcoded that they can only work with a specific path, like they do in the IU video. The TR doesn't seem to have a place to bind Indirect Tags in the way that I feel like it should.
I see that I can sort of solve this by making the TR use a dataset, where I have manually enumerated N rows, all of which having the same value for the column tagFolderPath, and having the index in the second column. This sort of defeats the purpose of making this dynamic, so I don't like it as a solution. No dataset should have all the same value in a given column. I also couldn't figure out how to make the Cell Update binding dynamically bind to replace all values in column "tagFolderPath" to a Template Parameter without hardcoding all the column updates, which once again will defy the purpose of having a dynamic system. Making an arbitrarily large number of rows leaves dead templates in its wake (or spaces where quality-code disabled templates are hiding)
Anyone have any tips? Maybe I need to dynamically generate a dataset using an expression? I haven't seen any "for loop" type expressions though -- without cracking all the way into python scripting, I'm not really sure how to dynamically create a dataset which might look like
[
"[HMI]deviceA/", "instance_" , 0],
"[HMI]deviceA/", "instance_" , 1],
"[HMI]deviceA/", "instance_" , 2],
"[HMI]deviceA/", "instance_" , 3]
]
Is this only possible via scripting?