I’m using a regular table that uses a SELECT * query for its data, and users are able to select any row right now. However, some of these rows are no longer used and in an effort to prevent mistakes, I’d like to remove the option to select these rows. I tried manipulating the SQL query to not show rows with obsolete values, but due to legacy stuff, it seemed that it broke a program (outside of ignition) that is used on the data. So it seems the solution would be to leave these values in the table, but make it so that the user can’t select them, is there a way to make certain rows unselectable?
I assume there’s some column or marker that indicates whether a row is used or not?
I would make a table property change script that looks like
if event.propertyName=='selectedRow': # logic to figure out if the row is not used, if notUsed: event.source.selectedRow=-1
selectedRow=-1 is the same as deselecting. So effectively they can’t select those rows.
I do find it a bit odd that an outside program relied on a visual window/table of an Ignition app instead of just querying the database directly.
There’s no column or marker, unfortunately. It’s going to have to be something like a bunch of "or"s to see if the value of the selected row == one of the values I’m avoiding. I know in power tables it’s possible to return the foreground color in a different color for certain rows, do tables have a similar functionality? I also find it odd, but can’t think of any other reason why my select query alteration would mess up functionality of the other program we use. Removing my alterations seemed to fix the problem. I’m not exactly sure of the hows or whys of it, but that’s just my best guess.
Thank you for the help!
There is the getForegroundColor or getBackgroundColor extension function of Tables - I think that might suit your needs. You can look at the data of the row to determine foreground coloring or background coloring of the row.