Creating a Summary Page for UDT Tags in Perspective Flex Repeater

Good Morning,

I am working within Perspective and I need some help.This project is within a flex repeater. What I am wanting to do is create a summary page of the tags in a UDT that would be put in a table. I have a variety of different tag types, but when the table is populated on the summary page, it must only populate with the active row (I have a tag for that). I was just wondering what is the best way to do this?

here is an image on what I am after:

Thanks,
Ryan

There are several different ways you could do this, but I would use a combination of system.tag.browse() starting at the root tag path of your Row UDTs and system.tag.readBlocking() to read the desired tags within the rows(looks like that would be your header values and Row Active member). You can dynamically append dictionaries of the desired tags to a list based on the Row Active value. You would put this binding that returns the list on the instances property of the flex repeater.

Thanks for the response Reese.

Would have anything in the past I could reference to get the ball rolling? Otherwise I will give it a crack.

Something along these lines. You will have to tweak for your environment, but hopefully that gets you going in the right direction.

path = '[default]'
finalList = []
rows = system.tag.browse(path, {'name': '*row*'})
for row in rows:
	print row['fullPath']
	rowActivePath =str(row['fullPath'])+'/Row Active'
	rowActive = system.tag.readBlocking([rowActivePath])[0].value

	if rowActive:
		data = {
			'activeBatch': 'value',
			'activeCode': 'value',
			'comp1': 'value',
			'comp2': 'value'
		}
		finalList.append(data)

return finalList

Ewww! Don't do that inside a loop. Use a loop or comprehension to feed all of the tagpaths to a single readBlocking() call.

2 Likes

These are conflicting. Are you wanting the result to be a flex repeater or a table?

If it's a table, then you would need to use the Reese's approach, except bulk read the tags (as Phil said) and then create the dataset for the table. (Or you could use Phil's toolkit module's tags expression function to subscribe to a dynamic list of tags and create the dataset from that)

If it's a flex repeater, then you can use the tag.browse function (faster than the tag.query function) to find all of your UDT Instances and create your flex repeater's instances list passing in the tagpath to the udt instances into that. Then the flex repeater's rows template would bind to the tags in your UDT for display

Thanks @Reese_Tyson, I used your approach with @pturmel read and got the result I was after. Thanks for the help!