Best way to quickly show large qty of tags and their values

Using Ignition 7.7, I have about 300 tags that I would like to present to the end user in a format similar to what we see in the tag browser. At a minimum, I would like a list of all tags in the end users project showing column 1 as tag names and column 2 as tags’ current values and have this list scrollable on a single window. Even better would be to have them in a hierarchical folder format like we see the tag browser. What is the best way to go about either one of these?

I tried setting up standard and block transaction groups thinking I would then but them in to a table. Using the standard group, I believe that I would have to somehow pivot the wide table to get tag names in column 1 with current values in column 2 but not sure how to do this without manually creating a query for every column. Is there an easy way to do this pivot?

Block groups seem to be the solution but when I highlight a group of tags and drag to a block group, I get a number for each tag instead of a name in the db. How or can I get a tag name on every row?

Thanks

the easiest way would be to write a script that uses system.tag.readAll and push it to a table component.

I havent experimented with the new template repeater in 7.7, but I would imagine you could come up with something using that component also.

Thanks for the help! The system.tag.readAll will probably work if I can write the script so that I don’t have to manually enter every tag path. How would I re-write the example below to read “Tags/T1 through Tags/T100" instead of listing the tag paths manually? (I am not a programmer so learning from scratch)

tags = [“Tags/T1”, “Tags/T2”, “Tags/T3”, “Tags/T4”, “Tags/T5”]
values = system.tag.readAll(tags)
for x in range(len(tags)):
print “%s = %s” % (tags[x], values[x])

I like the template idea and tried for several hours last night with no luck. Using my limited knowledge of templates and going through all the online training again, my template still requires manually entering the tag path in it’s Template Parameters. This will be way too time consuming with several hundred tags. It would be really cool to make a template that lets me drag a tag or group of tags onto a window and then displays the tag path(s) or name(s) and their value(s). --If anyone has any thoughts.

thanks

To read a group of tags in the format you have shown you could do -

[code]startValue = 1
endValue = 100
tags = []
for x in range(startValue, (endValue+1)):
tags.append(“Tags/T%i”%x)

values = system.tag.readAll(tags)

for tag in range(len(tags)):
print “%s = %s” % (tags[tag], values[tag])[/code]

I am getting the result that I want now using the following code:

tags = system.tag.browseTagsSimple("Sim/Ramp/", "ASC")
for x in tags:
	qv = system.tag.read(x.path)
	print x.path, qv.value

but I’m still trying to figure out how to run this every few seconds and get the output into a table or dataset if someone would point me in the right direction.

Thanks,

Take a look at system.dataset.toDataSet

Instead of printing the values, you make them into one row of the dataset. (See? that was a hint right there! :laughing: )

As a side note, you may want to consider two loops. One to create a list of tag names, then use system.tag.readAll, then the other loop to create the dataset. Individual reads may be okay for a few tags, but it might drag a bit to do a few hundred.

Nice to see you’re coming along!

I’m learning a lot of valuable stuff coding this but it seems like I should be able to do this with a transaction group. I have a transaction group that is storing a wide table like this:

ndx ramp0 ramp1 ramp2 ramp3
1 661 96 36 304

But I want the output to look like this:

ramp0 661
ramp1 96
ramp2 36
ramp3 304

Can I set the transaction group up to record in this format? If not, how would I write the query to return in this format?

I tried using a block group but when I but when I highlight a group of tags and drag to a block group, I get a number for each tag instead of a name for each one in the table.

thanks

Block groups will also have a block_id and row_id columns (don’t remember if they’re enabled by default, but I highly recommend them). This will further delineate your data going into it. I generally hand-make a table that will match up a row_id with a friendlier looking string.

After that, a query that joins the two tables will give what you want.

This seems to be getting a bit further afield than where we started. :scratch: Not that I mind, but I don’t want to start muddying the waters if we don’t have to…

If you’re looking to display a list of tag names and live values where all the tags are of the same data type I would use the Template Repeater. Create a template, add a property to the template like TagPath and use that property to bind to the values you want to display in the template. Put a Template Repeater on a window, set the Repeat Behavior to Dataset. Then you could use system.tag.browseTagsSimple() to populate a dataset for the tags you want to view and then assign that dataset to the Template Repeater.

I think this is more efficient than using system.tag.readAll(), plus you don’t have to worry about constantly updating the values since they are bound. This is certainly easier than trying to use Transaction Groups and pull the data from the database.

You can learn more about the Template Repeater here, 1:50 is where they start talking about the Repeat Behavior using a dataset. https://inductiveuniversity.com/video/template-repeater?r=/course/templates

I have a template repeater working properly if I build the template repeater’s dataset table by hand.

I now have a script building the table that I want to use to feed the the template repeater component. (At least my script works if I tie it to mouse click on a table component.)

All this prompted some more questions that I am struggling to answer:

[ul]
Where/how do I enter this script in the template repeater component so that I can set it to update on a set interval?

Where/how would I run this script in a central location on the client so that multiple components can access the resulting dataset? - or do I have to run it separately on every component that’s using it? Lets just assume I have a table component and a template repeater on different pages in the same project that both use the same data.

How would I write this to a table in a mySQL database?
[/ul]

Thanks,

BTW - here is the script. - this caused a brief moment of celebration for the new guy! :smiley:

rows = []
tags = system.tag.browseTagsSimple("Sim/Ramp/", "ASC")
for x in tags:
	qv = system.tag.read(x.path)
	oneRow = [x.name, qv.value]
	rows.append(oneRow)
 
headers = ["tagpath", "tagvalue"]
data = system.dataset.toDataSet(headers, rows)
 
table = event.source.parent.getComponent("Table")
table.data = data

[quote=“jasonmilner”]
[ul]
Where/how do I enter this script in the template repeater component so that I can set it to update on a set interval?

Where/how would I run this script in a central location on the client so that multiple components can access the resulting dataset? - or do I have to run it separately on every component that’s using it? Lets just assume I have a table component and a template repeater on different pages in the same project that both use the same data.

How would I write this to a table in a mySQL database?
[/ul][/quote]

You only need to update the template repeater dataset when you wish to display different templates. You don’t need to update the dataset in order to update tag values shown in the template, this should already be accomplished in the template with databinding.

If you want multiple components to access the dataset then you could create a property on a window that is always open, like a navigation window.

If you wanted to store the dataset in a database you would probably use system.db.runPrepUpdate(), but it would take some scripting to accomplish that.

did you ever finish this project? I am doing something similar now and didn’t want to reinvent the wheel. Thanks

If you want to display UDT Tag values in a table, I created a Template that will do that. It’s available here https://www.inductiveautomation.com/forum/viewtopic.php?f=81&t=13072 or in the Cloud Template Browser.

No, I ran into a time constraint and still had not worked it out so I manually created displays for about 100 tags for a demo to a customer. I will have to circle back and work on it eventually though. Thanks everyone for your help.