Displaying Recorded Tag Values Into Tables With Scripting

Good morning everyone! Ignition newbie here. I am trying to create a testing program in Vision and could use some help. The basic rundown of what I'm trying to do is as follows:

I would like the operator to be able to run through a site cause & effect check by only having to press one button.

For this example, we will use 5 devices. I want there to be a table where the operator can click check boxes for which devices are present on the left hand side, then at the top of the table, I want the same check box enable function for the effects. I want the operator to then be able to press the button and have Ignition start with Device 1 and write a value above the setpoint to that device. I then want to record the states of the boolean tags that are enabled at the top of the table and record their current values to that same table (or to a report would be fine.) I then want Ignition to move on to the next device and do the same thing, repeating until all devices are finished.

All tags are crated and I already have buttons that can write values to large numbers of tags and do a reset for the site using indirect tagging with a text field.

The main issue I am struggling with is making a script that can be configured to run sequentially for only the devices that are present and then recording the state of the corresponding tags and freezing that row of data, allowing me to reset and see their states after changing the second device while still maintaining the original data.

I want this to be as simple as possible and able to be deployed in the field on a closed network, so SQL queries are not an option.

Any help would be appreciated. Thank you!

Welcome to the Forum!

What have you tried and what didn't work?

You will want to run this on a background thread, there are several posts around the forum on properly utilizing system.util.invokeAsynchronous() and system.util.invokeLater()

You can use system.device.listDevices() to get a dataset of the configured devices and loop through that to run your checks.

Thanks for the reply. I will look at those functions for sure.

To be honest, I haven't been sure what to try. I am still working my through Inductive University but have also been assigned this task in the meantime.

I had originally created a table with the Bool tag values I wanted represented in the table and that plus my scripted button that writes values to the tags works fine. The problem is the entire column of Bool values is the same and they will all change instead of recording the values then moving to the next row.

I've been playing with Historian and Reporting but haven't made it to Reporting in IU yet so I'm not completely sure what all I am able to do. I am also a novice with Python syntax so I'm trying to pick up as much as I can as fast as I can.

I'm not sure I understand exactly what your issue is. Can you elaborate on this, maybe provide some example data or screen shots of what you're looking for?

Sure, to clarify a bit,

I am trying to create a table like this in my runtime. The table will have checkboxes above each column and to the left of each row.

An operator will be able to check off which devices in which rows and columns are present.

Once the boxes have been checked for which devices are on site, he will then press a button in the runtime. That button will execute a script that will write a process value to the correct tag for the device in the first row. When that process values goes above its setpoint, the logic in the PLC will change the values of all the Boolean tags that are represented in the columns.

I want to change the values in the intersecting cells (where the x's are currently) for only the row of the device currently being tested. Then once all the values have changed, I want to record those values and save them as they are. Then the script will reset the site and proceed with the same process for the device in the next row - driving the process value above the set point and recording the Boolean values for each column that intersect with that specific row, leaving the rows above and below it alone.

I would like this to take place for every row and every column that had been previously checked by the operator.

The parts I am having issues with is having the script see which rows and columns would have that Boolean value from the check box and then having only the values in a specific row change.

Take column XY_0001 for example. Each cell under that column is represented by the same tag value so currently the value will be the same in each column. I want the values to be saved as the results of the test for its own column instead of the realtime value.

  1. Operator checks off columns and rows that are to be part of the script.
  2. Operator presses button.
  3. Button executes script.
    A. If HS_0001 row has been checked, script will write value to the tag, driving it above its set point
    B. Once the value is above the set point, the values of the boolean tags of the columns will change.
    C. If the value is a 1, it will check the cell, if it is zero, it will uncheck it.
    D. Once the values change, the script will move onto the next row if it has been checkd off until the
    script has run for all rows with a TRUE value in the cell before it and for all columns with a TRUE
    value in the cells above them.

I have the scripting down for writing values to the tags that I need. The issue is currently that I can only figure out how to assign the realtime tag values to each cell vs. having it save the values at that specific point in time in the script to the cell in that specific row before doing it again for the next iteration of the script in the next row.

If the logic calls for the value of XY_0001 to be TRUE for the row for HS_0001.Shutdown but FALSE for HS_0002.Shutdown I wanted it to be represented like that its respective cell.

I'm sorry, I'm doing my best to be as clear as possible about what I'm trying to accomplish.

I'm a bit confused by that.
How are you filling this table ?

The table that I screenshotted is just one I created in Excel.

I have an existing Cause and Effect document that is where the data will ultimately come from.

Currently, I would fill the rows and columns manually to match the existing excel spreadsheet and assign each cell to the correct tag, but this results in each column under the right side having the same tag value which just changes to match the tag value instead of matching the tag value that existed during the portion of the test that corresponds to its row.

I'm sorry, the whole thing confuses me way too much.

So, let's try turning the verbosity level down just a little bit:

  • you have a table, where each cell is bound to a tag (ultimately, for now you're just putting in values by hand)
  • operators can select rows and columns
  • columns are devices and rows are statuses/events/something else entirely ?
  • clicking a button starts the execution of a script that runs tests on selected devices, for each selected row
  • the results of the tests are put in the cells at the proper row/column intersection

Is this about right so far ?

Yes that is essentially what I am after.

How will you know which device tag is represented by the row, column combination? Is there some repeatable naming convention?

There are pre-existing tags that have their own names and naming convention already. The row will list out the specific device and tag that is being tested in its own column on the left. I.e. HS_0001.Shutown

So just to be sure were on the same page one column will be the Ignition Tag Name?

Then can you try to clarify what that means ?

I fail to see how one operation could affect several cells.

So if you reference the screenshot I posted towards the top, the 2nd label - XY_0001 represents a tag that is a permissive. Every cell underneath XY_0001 is the same permissive tag.

When the tags in the rows on the left trip, i.e. HS_0001.Shutdown, it will either leave that permissive in a TRUE state or a FALSE state depending on the logic.

Each separate tag on the left could have a different effect for XY_0001.

HS_0001.Shutdown could leave it TRUE while HS_0002.Shutdown leaves it false. In this case, during the test, the intersecting columns would be reading the same tag for XY_0001 but in each case the result will be different and I need to show the individual results of the test rather than the live value of the tag.

Basically, you want snapshot the tags into rows of a dataset? And display it in a table? And then do what with it?

That's it. I just want to run the script which will test the different shutdowns and alarms, snapshot the data into their corresponding cells, then display the table on the screen for the operator to visually check against their reference spreadsheet

Don't bind the tags to the cells then. Just write their values once they have been evaluated.


Is that possible with a regular table or would that have to go into a report?

The table holds a dataset, you're just going to build the dataset. The table will then display it.