Multi-input dynamic Template Repeaters: is this possible?

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:


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?

Yes. There is no expression that can generate a dataset from a list of strings, or perhaps better stated: from a list of UDT tag paths for indirect bindings. Scripting would be needed for this.

Just curious why you would want to avoid scripting for this application? There are plenty of examples using system.tag.browse in both the user manual and here on this forum. Using the template repeater in vision, and the flex repeater and view canvas in perspective with dynamically generated instances really unleashes the power of ignition, whether the source of the instances is a tag folder, a database query, or a business logic API.

1 Like

I'm hoping to get as much lightly-adjusted-out-of-the-box value as I can before diving into a script solution. I'm no stranger to scripting (already use it for mapping my modbus tags, for example) but it's a whole can of worms.

Also I don't love the scripting interface -- python 2.7 with a command line that doesn't show me where my cursor is and has an extra wall of java trace info for every exception :nauseated_face:

But it seems to be the way to get what I want here, so Ill be doing it anyway! Just sad because the widget seems so close to capable of doing this on its own.

Jython 2.7 actually, hence the Java stack

Where are you trying to type your code into? I've never had an issue with cursor visibility.
Edit: I do have issues if I have my monitor set to non-100% scaling in Windows

The way I see it: you can either avoid using Jython because of a slight inconvenience, or you can realise that each programming language has its own peculiarities, and allow yourself to build advanced solutions regardless :person_shrugging:

Yes it would have to be jython or they would not still be on 2.7 in 2023.

It's just the default script console in the designer client, doesn't seem to have a cursor indicator on the console (right) side. I can check my scaling but I think it's all on default.

I don't mind writing scripts, it's one of my favorite things to do. That said, I have many other things I need to do and was hoping to get more performance out of the box.

I don't use the right side; I only use the left. The console side is really only useful for one-liners which for me is very rare

I'm still sussing out a lot of things and want to look at quick outputs. Once I get over that hump I wouldn't expect to use it terribly often either.