Sorting and moving tag values in a table

As Pascal stated, we'll need a bit more info to better help you out. But this is how I would do it, and perhaps give some inspiration.


A tag structure to put the curing racks in one area. My exmaple has 5 racks with a description and a cure time value. Also, since tags are global, I added a datast tag to hold our results.

image

Using a Gateway Timer Script:

basePaths = ['[Test]Curing Rack/%d/Description',
             '[Test]Curing Rack/%d/Cure Time'
            ]

# Create the list of tags to read
tagsIn = []
for i in xrange(5): # Number of racks
	tagsIn.extend([tag%(i+1) for tag in basePaths]) 

# Get the tag values
valuesIn = [tag.value for tag in system.tag.readAll(tagsIn)]

headers = ['Rack Pos', 'Curing Time']
# Split the flat value list into a list of lists.
data = [valuesIn[i:i+2] for i in xrange(0, len(valuesIn), 2)]

dataset = system.dataset.toDataSet(headers, data)

# Write the sorted dataset to the tag.
system.tag.write('[Test]Curing Rack/Dataset', system.dataset.sort(dataset, 'Curing Time', False))

image

Then, just bind the table to the dataset tag.