I am trying to edit a Power Table which has been successfully populated with data merged from a couple of CSV files.
def UpdateParamEditTable(): import system import sys window = system.gui.getWindow("Main Windows/ParameterEdit") # A new recipe or stations selection has been made. Clear the table. tbl = window.rootContainer.getComponent('ptblParams') # The Power Table. customizer = tbl.columnAttributesData # Save the customizers before we destroy them ... # The line above destroys the tblParams customizers which includes the "editable" property of the Setpoint column. tbl.columnAttributesData = customizer # This line restores the customizer. rows =  # Empty. # Code to read the CSV file into rows goes in here. header = ['Line', 'Description', 'Setpoint', 'Min', 'Max'] # Header rows for the table. tbl.data = system.dataset.toDataSet(header, rows) # Create the table dataset. # This works. The table is populated with the CSV data.
So far, so good. The Power Table is populated correctly.
The Power Table onDoubleClick code starts as follows:
def onDoubleClick(self, rowIndex, colIndex, colName, value, event): # Power Table double-click event. table = system.gui.getParentWindow(event).getPathForComponent(self) data = system.dataset.toDataSet(table.data) # Line 16.
I’m getting an error:
File "<extension-method onDoubleClick>", line 16, in onDoubleClick AttributeError: 'unicode' object has no attribute 'data'
which seems to indicate that the system thinks the Power Table is empty when it is clearly well populated. I’ve tried using system.dataset.toPyDataSet but receive the same error.
What am I not understanding here?