Populating a table with tag values

I wanted to update the dataset in a table with tag values and a few images. I saw in the manual it can be done and I just had a few questions regarding the recommended way to achieve my goal.

My design was to have some scripts that check the tag values and then populate the table upon a tag change, as for adding the images to the table I was unsure of how to do this.

Does anyone have any other ways or suggestions to populate the table and add images? Thanks

Use the cell update property binding?

I can use that to change an existing value to a new value, but I’m just looking for a good way to display tag values in a table, along with updating the table when the values change showing the previous and new data.

Right now I’m using scripting to get the tag values and set the data in the table. In order to update the table, first im getting the dataset from the table and then the values from the tags and putting them back into the table.

This seemed a little busy/messy, I was wondering if anyone had a better or more efficient way. Thanks!

do you have something like a last poll time or some other value that changes each time your device is polled?

The table has a setValue function which may be what your looking for:

setValue(row, column, value)

Sets the value in the specified cell, altering the table's Data property. Will fire a propertyChange event for the "data" property, as well as a cellEdited event.

Parameters
	int row - The index of the row to set the value at.
	int column - The index or name of the column to set a value at.
	PyObject value - The new value to use at the given row/column location.

Returns
	nothing

Example:

tbl = system.gui.getParentWindow(event).rootContainer.getComponent("Table")
tbl.setValue(0,0,100)

Thanks, ill try out setValue, since i am calling this from the script module, I take it this is what will find the correct table? “system.gui.getParentWindow(event)”

I still get confused when referencing components, thanks!

@diat150 I am just running a script every 5 seconds that checks the tag values and populates the table. I am trying to see if I need to keep a history of actions or just show the current ones if the user switches screens.

I’m trying to decide what the best way is, I might just use addRow and a client tag change script.

What about Transaction Groups? You could use a Block Group with the “insert changed rows” option. If you are using a script then the data will be lost when the window is closed.

Drewdin,
I am also new to Ignition and also not sure if I understood your question fully. If you are looking for having a table with tag value history, why cant you create a memory tag with read/write access and history tag with time tag source as tag with one time execution. In this way it saves the tag value every time it changes the value to historian. This memory tag can be pulled in to your table as dataset.
Is that what you were looking for?

i wanted to read 200+ tags from a plc and display it in an editable table format. I ended up using scripting and a client tag to refresh the table every ten seconds.

I do a similar thing from multiple plcs out on site but using MQTT. I send over the current time (which doesn’t have to be accurate) with all the other data. The transaction groups enters all the info into the database triggered by that time value changing (hence why It didn’t have to be accurate as it’s only looking for a difference), or in your case could be every ‘x’ seconds.

Once it’s in the database you can manipulate the data anyway you want.

1 Like