Table showing current values

I am trying out using/showing data from tags in a table and could use some direction on how to go about accomplishing this.

I have a series of tag folders Sine A, Sine B, Sine C with different tags in each.

And I would like to show the data in a table. How do I go about doing that?

Thanks for your help!!

Start with system.tag.browseTags to know which Sine# is in each folder (you can use that to find the Sine A/B/C folders too if that is unknown), then system.tag.readAll for all the paths in the browseTags results. You can place these in a python list then convert that to a dataset and use system.dataset.exportExcel. If you want to display in something like an Ignition Table/Power Table then of course no need for the last part, just convert to a dataset.

It depends on how scalable you want this to be. The solution mrogers gave works well when the number of concurrent clients is low. Lets walk through a use case of how we typically do something like this.

Lets imagine a SCADA system, with 2500 remote sites. Each sites gets poll periodically, or pushes data asynchronously. We need to detect when a change of data has occurred, typically, we wait for the number of bytes received to stop changing, or for a last poll timestamp to change. When this occurs, we insert a record into the database for that site, which would be similar to the folder structure you have defined. Because this is in the database now, you can apply query filters, and you should only have ~ 1 query per second per concurrent user. This removes the heavy lifting of polling the tag database, which gets computationally expensive when you have multiple clients. We have found a system similar to this to be much more scalable.

mrogers :
I tried this in steps and this is what I have but looks like I can never get the correct value for the tag and always get a -1. So i am guessing that the tag is incorrect so I have an if statement to see if the tag exists and always get a false. what am i doing incorrectly here?

tags = system.tag.browseTags(parentPath="", tagPath=“Sine”)
for tag in tags:
stags = system.tag.browseTags(parentpath=tag, tagPath="*")
print stags
for sstags in stags:
print sstags
qv =“sstags”)
if system.tag.exists(“qv”):
print qv.value
print " tag does not exist"

i tried to have a tag event script for tag value changed event and insert a record in the table with the updated value. so i am thinking that if i go about this way then i have to include a tag event script for every tag in the system. am i in the correct direction or is there a better way to do this?

I think your tag variable in line 3 (then sstags later on) should be tag.tagPath, because browseTags doesn’t give you a path string directly. For your tagPath in line 1 I think you need to add an asterisk at the end of the tagPath keyword, in this case its probably not finding anything because it is looking for “Sine” exactly but not finding anything.

Just FYI, there’s a format option here for preformatted text, especially with python it’s a little difficult to parse what should be indexed or not.

The key is detecting the fact that your device or site has updated. Lets take the following structure


I would make a new expression tag, lets call it changeEvent. The script could be hasChanged({rxBytes})||hasChanged({txBytes}). Now, when this goes false (It is no longer updating), I would run a script to update a database record with the current values of tag1,tag2,tag3, as an example. Does that make sense?

So, i corrected some of the issues and now I have the headers which are the tag name in a list and the values for the corresponding as another list and am getting the following error when trying to create a dataset

caused by ClassCastException: org.python.core.PyFloat cannot be cast to org.python.core.PySequence

the correct code is as follows

paths = []
header = []
rows = []

for tag in system.tag.browseTags(parentPath = ‘’, tagPath = ‘Sine ?/Sine*’,recursive = 1):
values = system.tag.readAll(paths)
print values
for x in range(len(paths)):
print “%.2f” %(values[x].value)
print header
print rows
tbldata = system.dataset.toDataSet(header, rows)

I think i get the bytes changing condition to know when to update and when to hold off but i am not clear on where this event needs to trigger from. Is it getting triggered at the tag level?

Yes, the tag that “detects” the event then fires the script, to gather the rest of the tags, and insert into the backend however you see fit.

What about doing something similar to this, but in ignition?

You could create a tag with a dataset that your tags update when they change and insert a row if they are not yet in the dataset. You could then have all clients poll this one tag and that would be pretty darn efficient if there are a lot of clients open.

Does anyone see flaws with this design? Is @Kyle_Chase’s answer more efficient or about equal?