I need to create a downtime reason table that will show the downtime for the entire shift. I have a Line Run Selector tied to a Downtime Reason table now, but that is not receiving overall approval. I have done some research, but haven’t found much already created. So, I’m attempting to build my own. I have a Power Table with data coming from a SQL query loading it. I also have a drop down created (dynamically populated) that displays the downtime reason codes & descriptions that also comes from a SQL query. My issue is that I cannot edit the table. I have the ID from the Downtime table (column 0) included in the query providing the data to the table, as well as the ReasonCode. However, I’m joining to the DowntimeReason table to provide the operator with the downtime reason description rather than just the code. So the ReasonCode column is hidden and the ReasonCodeDesc field is visible and editable. My dropdown menu has the reasoncode as column 0 and the visible description as column 1. The event handler that is creating the dropdown is the configureEditor event. In the onCellEdited event I have the following code:
# The row index of the edited row row = event.row # The column index of the edited column col = event.column # The column's name colName = 'ReasonCode' #event.source.data.getColumnName(col) # The new value value = event.newValue # The primary key's value (first column), so that the appropriate row can be updated in the db id = event.source.data.getValueAt(row, 0) # Run an update query to the table that is being edited to reflect any changes query = "UPDATE Ignition_MES.dbo.Downtime SET %s = ? WHERE ID = ?" system.db.runPrepStmt(query % colName, [value, id])
However, when the dropdown fires, and I click on a dropdown option, it does not save the selection.