def valueChanged(tag, tagPath, previousValue, currentValue, initialChange, missedEvents):
"""
Fired whenever the current value changes in value or quality.
Arguments:
tag: The source tag object. A read-only wrapper for obtaining tag
properties.
tagPath: The full path to the tag (String)
previousValue: The previous value. This is a "qualified value", so it
has value, quality, and timestamp properties.
currentValue: The current value. This is a "qualified value", so it has
value, quality, and timestamp properties.
initialChange: A boolean flag indicating whether this event is due to
the first execution or initial subscription.
missedEvents: A flag indicating that some events have been skipped due
to event overflow.
"""
var = system.tag.read("[.]/Querry")
data = system.dataset.toPyDataSet(var.value)
system.tag.write("[.]/Data/Lots", data)
So i need to read the querry tag and append only the first row of memory tag.
If you just want the first row from the source tag, the simplest way is to construct another dataset that has the other rows deleted. Ignition can do that with system.dataset.deleteRows(). Something like this:
That’s it. Note that datasets are supposed to be immutable – you don’t modify them, you make new ones with the change(s) you want. Also, you don’t need a PyDataset unless you wish to loop through its rows with a simple for loop.
then wanted to take that dataset with one row and update the target tags first row.
Or maybe I am way off.
I have a large querry that gets dumped into this source tag.
Then writing to the mem tag for a table. That they are going to do work against. (selecting the rows and making print jobs and writing back to a diff db)
I think so. Your mem tag is going to get clobbered every time the original query runs. Editing tables in place is tricky with bindings. Consider just showing the source query to your users in a read-only table. (With the query right there on the table, not a tag.) When they pick a row other than the first, enable the buttons and/or editable fields for their task. When that task is done, script an update query on the source table (marking that row done or whatever), then fire a refresh on the table's sql binding so that row will disappear.
If the task involves editing some of that row data, do it one at a time, and consider using the raw/dirty technique described here: