How to Dynamically Bind Tags from a Folder to a Flex Repeater in Ignition Perspective?

Hello everyone,

I am currently working on a project in Ignition Perspective and I want to use the Flex Repeater to dynamically display tags from a specific folder.

I have a folder with tags in Ignition, and I want each tag from that folder to be displayed as an instance in the Flex Repeater. Is there a way to bind the tags to the Instances property of the Flex Repeater so that the corresponding number of instances is automatically created based on the number of tags in the folder?

Could someone help with an example of how to set this up? What bindings should I use to display the tags from the folder as instances in the Flex Repeater?

Also, it would be helpful to hear how you can use system.tag.browse or a similar function to get a list of tags from a folder and how to bind that list to the Flex Repeater.

Thanks in advance!

Use system.tag.browse to get all the tag paths from the folder, and pass each tag path as a parameter per instance in the flex repeater.

Build your embedded view (the one that the flex repeater will use) to accept a tag path as a parameter and use that to indirectly bind to the tag.

The instances property of the flex repeater expects a list of dictionaries.
dictList = [{x: 1, Y: index} for index in xrange(10)] is the basic list comprehension for making a list of dictionaries.

Edit: Found this post which is accomplishing a similar task of looking through a folder of tags and adding instances to a flex repeater. Should help to point you in the right direction:

1 Like

This might be enough to get you started.

Open Script Console and try the following code:

tags = system.tag.browse("[provider]folderName/", {})
for tag in tags:
	print tag
	print tag['fullPath']

Full response:

  • On the Flex Repeater add a custom property, folderPath and set the value. It should look something like
    folderPath : [default]myTagFolder
    (Doing this will allow you to change the tag path without touching the binding / script.)
  • Create a Property Binding on PROPS.instances and Script Transform as shown below.
Script.
def transform(self, value, quality, timestamp):
	tags = system.tag.browse(value, {})
	instances = []
	for tag in tags:
		instances.append({
		  "instanceStyle": {
		    "classes": ""
		  },
		  "instancePosition": {},
		  "tagPath": tag['fullPath']
		})
	return instances
3 Likes

Hi, thank you for your response, it was very helpful. Now, I have as many instances as tags, but I don't have their values (which are of boolean type). I have 20 instances (they are labels). Can I assign boolean values to these 20 label instances? Thank you in advance.

In the script shown, we've passed tagPath as a parameter to each instance of the repeated view.

  • On your repeating view, create PARAMS.tagPath. Give it a value of a real tag so it shows something sensible in Designer.
  • On the repeating view create a Property binding on the boolean display component's value property to view.params.tagPath. (Select it using the Browse Properties button to avoid errors.)

I don't know if I did it wrong, but now I have paths on my instances not boolean true/false, I am so sorry if my questions are dumb, but I am learning Ignition for only few days now.

Have you gone through the free Inductive University online courses? They will cover all of the basics you are struggling with.

  1. What component are you using to display the boolean? Checkbox, Toggle Switch, Label?
  2. How did you bind the component to the view parameter?