Table component: Column Attribute Data

Is there any way to force an update of the Column Attribute Data of the Table component? This dataset is ‘None’ until the table is manually modified via the Table Customizer in the Designer.

I see in the forums that there are questions on this dating back to 2010.
Is this feature available yet, or has anyone created a workaround?


You cannot force an update. The Table Customizer in the designer is the only code that writes to this dataset. What you can do, though, is generate what you need yourself with scripting. Or, if you have a limited set of possible columns for the different datasets displayed, populate the dataset one time with all of those columns defined.

Thanks Phil
It appears that the columnAttributesTable dataset (always?) has 30 columns, one for each formatting attribute that is exposed.
It has n rows, one for each column of the source ‘data’ (the dataset whose data is displayed on the table).

So I guess what you are saying is, in the template:

  1. create a ‘default’ row in the template.
  2. for each column in the ‘data’ dataset, create a new row in a new dataset using the default row
  3. assign this new dataset to the columnAttributesTable of the table in the template
    So, the template will have a “standard” table, but with the columnAttributesTable configured as a dataset instead of None

Then, when I instantiate an instance, update the columnAttributesTable dataset as required. Note: The only attributes I plan to change are the ‘editable’ and ‘hidden’ attributes.

Is this what you are suggesting? From your experience, can the columnAttributesTable be updated in this way?


  1. The ‘default’ row doesn’t need to be in the dataset. It can be constructed in code as needed, or stored in code as a list of values. Depends on (2).

  2. Yes, one row in the c-a-d for each column in data. Constructed any way you wish.

  3. Yes. Or simply construct a single dataset with a row for every possible column name and suitable attributes. (Cutting and pasting into multiple setups into a text file after using the customizer is my preferred method, editing the text to paste back into the final c-a-d.) With that, you could use cell bindings to update the editable and hidden attributes on certain rows.

Thanks Phil
I am having trouble with two of the columns in the c-a-d dataset, which are colors.
No matter what I try I get an fatal error when trying to assign a color to these columns.

That’s why I originally wanted to force a refresh (to grab the existing values), then simply update the specific attributes, ‘editable’ and ‘hidden’ as required.

Show your code and your exceptions and we can probably figure it out. Are you populating those columns with actual color objects? (See system.gui.color().)

srcData = event.source.parent.getComponent(‘Table’).data # sourceData

headers = [‘name’, ‘bgcolorMap’, ‘bgcolorMapColumn’, ‘dateFormat’, ‘editable’, ‘fgcolorMap’, ‘fgcolorMapColumn’, ‘fontMap’, ‘fontMapColumn’, ‘headerAlignment’, ‘hidden’, ‘hideTextOverProgressbar’, ‘horizontalAlignment’, ‘imageMap’, ‘imageMapColumn’, ‘label’, ‘locale’, ‘numberFormat’, ‘prefix’, ‘progressBackground’, ‘progressForeground’, ‘progressRange’, ‘sortable’, ‘suffix’, ‘translateMap’, ‘translateMapColumn’, ‘treatAsBoolean’, ‘treatAsProgressBar’, ‘verticalAlignment’, ‘width’]

rows = []

new_c_a_ds = system.dataset.toDataSet(headers, rows)

color = system.gui.color(255, 255, 255)

newRow = [“ID”, “”, “”, “”, “”, “”, “”, “”, “”, “”, “”, “”, “”, “”, “”, “”, “”, “”, “”, color, color , “”, “”, “”, “”, “”, “”, “”, “”, “”,]

new_c_a_ds = system.dataset.addRow(new_c_a_ds, newRow)

event.source.parent.getComponent(‘Table’).columnAttributesData = new_c_a_ds

This code fails with: “[Fatal Error] :1:1: Premature end of file.”

If I replace the ‘color’ variable with a string “255,255,255” I get the same error.
If I replace the ‘color’ variable with an empty string “” I get an error : Cannot coerce string value “” into a color

Not sure what to try next.


Please put triple back-quotes above and below your code so we can see it clearly.

Aside from that, I can see that your empty strings will cause problems with column datatypes. Open a a c-a-d after using the customizer, and copy that to the clipboard. Paste that text here (again within triple-backquotes) and note the data types shown in the header. You have to use those datatypes in every row you put into your custom c-a-d.
Also, there’s no need to use system.dataset.addRow if you are going to use system.dataset.toDataSet(). Just put all of the rows you want into your rows list before calling the latter.

ok, thanks Phil

It’s sorted now.
The colors were ok, but issues with other data types noow resolved.
Thanks for the guidance

I am having difficulty customizing a table component. I’d like to assign the numberFormat of the columnAttributesData to match the tag ‘FormatString’. But I am not getting the c-a-d to update at all. I can find the tag format string easily enough, but cannot seem to get the c-a-d to update unless I open the customizer in the designer then click ‘OK’. Just to be clear, the tags are populated dynamically via user browsing and selection, so the tag dataset may be of varying sizes etc. thank you.

You have to construct a new c-a-d dataset with a script and assign it the the property. While it is possible to modify a dataset in place (mostly), that doesn’t trigger any propertyChange event that would cause the affected object to notice. Which is why all system.* functions that manipulate datasets leave the original untouched and deliver a new one with the requested changes.

Hello Phil. Thank you for the detailed reply. I have modified my application to created a new c-a-d then assign it to the datatable property. However, I am not getting the behavior that indicates the application is aware of the dataset change or applying the changes. I want to deliver numerical precision based on the tag metadata; for instance my NTU (turbidity) tags need three decimals, but the default is two. the ‘cad’ is a custom property (dataset) on the datatable. Even though I can see the cad being updated, and the .columnAttributesData also update, I do not get the precision I want even when the numberFormat is updated. I have checked in the Designer and also in Staging (I am running ver 7.9.12). Any ideas? thank you.

My ‘load tags’ button does this:

cad = self.parent.parent.getComponent('Data Table').columnAttributesData
blankRow = ["Date/Time","","","MMM d, yyyy h:mm a","false","","","","","0","false","false","-9","","","<HTML>&nbsp;<br>&nbsp;<br>Date/Time&nbsp;<br>&nbsp;<br>&nbsp;","en","#,##0.##","","color(255,255,255,255)","color(153,157,158,255)","<doubledimension><width>0.0</width><height>100.0</height></doubledimension>","true","","","","false","false","0","173"]

I get the tag format:

get the number format string of the tag

		tagPath = row['selectedPath']				
		formatPath = '%s.FormatString' % (tagPath)
		format =

then later in the script, for row in browse selection:

set the row field to the tag value for numberFormat

		blankRow[0] = fullName
		blankRow[15] = "<HTML>&nbsp;<br>&nbsp;<br>%s&nbsp;<br>&nbsp;<br>&nbsp;" % (fullName)
		blankRow[17] = format

append the dataset

		cad = system.dataset.addRow(cad, blankRow)
		self.parent.parent.getComponent('Data Table').cad = cad

Then in the datatable script the following:
event.source.parent.getComponent(‘Data Table’).columnAttributesData = event.source.parent.getComponent(‘Data Table’).cad

Do you end up with trailing hash marks ‘#’ for your decimal places? If so, that’s your problem. The hash mark is for optional digits. To force trailing zeros, use the ‘0’ placeholder.