Edit Column Attributes Dataset

I am trying to edit a tables attributes with a button press script. But am getting the following error:

File “event:mousePressed”, line 2, in

TypeError: setValue(): 1st arg can’t be coerced to com.inductiveautomation.ignition.common.Dataset

Ignition v7.9.9 (b2018081621)
Java: Oracle Corporation 1.8.0_191

Here is the code I am trying to use:

table = event.source.parent.getComponent('Table').columnAttributesData
newData = system.dataset.setValue(table.data, 1, 'editable', 1)
table.data = newData

Is it possible to edit the attributes dataset?

Take the .data off of your setValue call.
You are assigning “table” to the column attribute dataset the line above it.

I tried that but when I do that I get the following

File “event:mousePressed”, line 3, in

TypeError: can’t convert Dataset [6R ? 30C] to [[Ljava.lang.Object;

Take a look at this script. If you analyze it you should be able to see the places where your script went off track.

table = event.source.parent.getComponent('Table')
columnData = table.columnAttributesData
newData = system.dataset.setValue(columnData, 1, 'editable', 1)
table.columnAttributesData = newData
1 Like