How to pass value from dropdown list to template repeater

I have a template where the background changes color based on the user. I have a window with a template repeater using that template. The window has a dropdown list of users and I am trying to pass in the value of the dropdown list into the template repeater. I can’t figure out how to do it

Create a template parameter on the template. This will show up like a property on the template instance in the window. You can bind this property to the selected value of the dropdown.

https://docs.inductiveautomation.com/display/DOC81/Creating+a+Template#CreatingaTemplate-DynamicTemplates

I have the template repeater set to Dataset and I have added another column for the second parameter in my template. How would I access a value from the dropdown if its on the same window? So the path to the window component of the dropdown is Main/Overview/Root Container/Dropdown. What would I put in the dataset to access that value of the dropdown?

I think you could use a cell update binding (or several).

I would use a client tag for this if feasible. The dropdown writes to the client tag, then the template reads that directly. Of course, if you’re using this in multiple instances of template repeaters and with other independent dropdowns, this won’t work

I know in Perspective you can definitely do that and its straight forward but not sure this would work for me in vision

Worked perfect thanks!

How can a template repeater directly read a client tag? Im assuming itd be through the template parameters which is a dataset... so i guess the better question would be, how can i get the template parameter dataset within the repeater to read the client tag for each instance within the repeater?

You don't. Simply supply the tag paths as a string in the repeater's dataset in a column that matches a custom property on your template. Then, use an indirect tag binding to get the tag value into the template that is being repeated using the tag path that is passed into the custom property.

Often times, I will build the tag path in the template with an expression binding using a root string that is common to all the possible tag paths. This way I only have to pass in the non-redundant parts.

I would recommend passing the full tagpath (or at least the full start of the tagpath) all the time tbh. I've run into situations years ago when I did this (passed in only the changing parts) and then regretted it as I then wanted to use the templates for other tags that didn't conform to the strict tagpath I'd cornered myself into using. Passing the full start of the tagpath lets you use the templates more generally

2 Likes