Need help making a list

Hello I have 10 ovens that I want to make a list with. I have a tag that shows me how long the oven has remaining in seconds and I want to have the top of the list show which oven is going to be finished next.

I am new to ignition and don't know if this can be done so looking for some help on this thank you!

Something like this:

#assuming that ovens are numbered and start from 0
tagPaths = ['path/to/oven{}/timeremaining'.format(i) for i in range(numberOfOvens)]
ovens = [qv.value for qv in system.tag.readBlocking(tagPaths)]
return ovens.sort()

About the best I can do without a little more information about exactly where and what you're trying to accomplish.

I think you would return ovens and not the sort method. I've tripped over this one a few times

ovens.sort()
return ovens
1 Like

Hello thank you for your quick responses I think that I want to use the table component but need to know how or if I can sort the table by the value in the rows.

Show the binding or script where the data for this table is coming from

image

Try turning this into an expression binding, add the tag path and use a sorting function.

sortDataset({tagPath}, 1)

I misunderstood the binding, you have tags bound to each row of your table data.

Correct

If the list of ovens won't change (often) make an expression structure binding, bring in all the ovens as separate elements, then use a transform script similar to the one posted above to transform into a structure the table expects.

2 Likes

As @PGriffith says, create an expression structure binding. Add an object member for each oven, and add an expression to read each tag.

For instance the expression for Oven1 would look like this:

{[default]Ovens/Oven1/DEKEMA_Furnace_Status/OPC_UA_DATA_RestTimeTotal}

Then add a script transform with the following:

return sorted([{'Oven':k,'Time_Remaining':v} for k,v in value.iteritems()], key=lambda oven:oven['Time_Remaining'])
2 Likes

Awesome, I ended up getting the table to sort through itself for now. I will be testing out the scripting method as well

Frankly with only 10 ovens, I'd create the list manually and actually bind each value to its corresponding tag, then let the table sort things itself.

2 Likes