Pass Array of Tag Paths to Template Repeater

Hi everyone!

I’m working on a project in Ignition and could use some advice. I have multiple screens with numerous setpoints, but instead of having the screens with all the setpoints, I’d like to create a popup that dynamically loads the setpoints for a specific screen.

Here’s what I’m trying to do:

  • I want to define a parameter that contains all the tag paths for the setpoints on a screen in an array structure
    image

  • I need to pass this array into the Template Repeater’s dataset parameter, so then it should dynamically create the same number of templates as the rows in the array.

I’m stuck on how to convert the array structure into a format that the Template Repeater's dataset. I tried with scripting, but I think I am not doing it in the right way.

Does anyone know how to do this? Or other ways to do it?

Thanks in advance!

There is no native way to do this. The only array-like or list-like datatype in Vision for custom properties is Dataset (or very recently, Document). You might find my Integration Toolkit's iteration functions helpful for situations like this. (Particularly the dataset-building unionAll() function, and the asList() function to supply values.)

Thanks for the response! Before trying use a 3rd party module, is there another way to solve this problem? Not by using an array custom property, but to have a popup that has the same number of templates as the screen required in a dynamic way.

You can always dynamically generate your dataset with a script.

Right now, I know how to modify the templateParams dataset in the Template Repeater, but my main challenge is figuring out how to make the number of tags dynamic.

For example, I can manually create multiple properties with individual tag paths, but that’s not ideal. Do you have any suggestions on how to pass a dynamic list of tag paths from a button click to the popup, so the number of templates adjusts automatically based on the provided tags?

Create a dataset custom property on the button to hold a constant dataset for the repeater. On the popup's root container, create a dataset custom parameter to be used as a window parameter. Bind the repeater's dataset property to the popup root container custom property. In the button's action script, retrieve its static dataset and pass it as a window parameter to the popup.

1 Like

Thank you! I'll try this approach.

Hi, Thanks for sharing this. I’m wondering, how can we update the dataset if the tag paths change after the popup opens? Should we use scripting to update it, or is there an easier way?

I could see dynamically changing tagpaths for a setpoint screen after a popup is loaded leading to unhappy surprises.

I would recommend building your popup to work off a tag path with indirect bindings. You can still indirectly bind everything and dynamically bulid out the list of setpoints based on the tags that exist for a device or system. I would also recommend passing in a unique identifier that ties that popup to that system or device so you can close it specifically.

This is an example script transform that browses a tag path and creates content based on the tags that exist in that tagpath.

def transform(self, value, quality, timestamp):
	 descList = system.tag.browse(value, {'name':'*Mode*'})
	 returnList = []
	 i = 0
	 
	 for x in descList:
	 	i += 1
	 	returnList.append(
  		{
	 	    "instanceStyle": {
	 	      "classes": ""
	 	    },
	 	    "instancePosition": {},
	 	   # "Description": "test", 
	 	    "Index": i,
	 	    "TagPath": value
	 	  })
	 	   
	 return returnList

In this case it was creating enumerated template instances that worked off indirect tag paths. I'm just trying to show you the general idea of using system.tag.browse to get information that your popup needs so you can pass in a partial tag path and dynamically build the popup content. This particular script is bespoke and was written to replace a very strange device control model in a legacy system so view it as an example of how to use system.tag.browse to generate dynamic content and not as a useful copy/paste script.

My advice to Jose was based on his specific use-case, where one or more main screens have buttons to open the popup, and where each button has a fixed set of tagpaths to show in the popup.

You should start a new topic explaining all the details of your situation, and how you want your popup to function.

1 Like

Thanks for explaining.
I’ll start a new topic and share all the details about my situation and what I need the popup to do. Really appreciate your help.

1 Like