i’m trying to change the columns attributes of a table (editable and treatAsBoolean) via python script using ColumnAttributesDataSet
i need scripting it 'cause columns are added runtime and i don’t their number.
i get this error:
TypeError: 'com.inductiveautomation.factorypmi.application.components.table.ColumnAttributesDataSet' object does not support item assignment
before loosing my mind finding a solution, can someone tell if ColumnAttributesDataSet is a read only dataset?
thanks
edit: this is my test code:
event.source.columnAttributesData[0, "editable"] = 1
uhm, i found i have a mistake in the script:
- accessing is to be done by the getValueAt method
- datasets are immutable, meaning they cannot change. i have to rewrite it from scratch…
Right they are immutable. But that is why we have these functions:
system.dataset.setValue
system.dataset.addRow
system.dataset.deleteRow
system.dataset.updateRow
and more. Here is a link to the usermanual:
http://www.inductiveautomation.com/support/usermanuals/ignition/system_dataset_setvalue.htm
So, using the setValue function you can update the dataset. However, you can also just simply bind the Column Attributes Data property to a cell update binding where you can bind individual cells to properties or tags. Here is some more information on that:
http://www.inductiveautomation.com/support/usermanuals/ignition/cell_update_binding.htm