Table Headers

Greetings IA Forum
My project has a lot of tables. I would like a better way to set the text in the table’s header ?
I am currently opening the table’s ‘Table Customiser’ and typing ‘Billet
Number

’ into the header field. This is time consuming.
Thx & regards
Steve Hargraves

the table attributes, which is what you are editing in the table customizer, is just a dataset. you can take that dataset, and make a new dataset with the headers the way you want them using scripting when the window opens.

If you are using the Power Table component you can use the configureHeaderStyle extension function. Here you can use Java to configure the header the way you want it to appear. In fact, there is an example piece of code there that will show you how you can configure the color and set the alignment of the text.

Hello IA Forum
If I go into a table’s dataset viewer & delete columns, the table’s Column Attributes Data dataset is not affected. Also what is the affect if I go into the table’s Column Attributes Data dataset viewer & delete all rows.? How is the table’s Column Attributes Data dataset replaced ?
Thanks & regards
Steve Hargraves

The column attributes dataset is constructed by the table customizer using the table data available at the time, plus any previous column attributes. Table data that shows up without a matching attributes entry gets default attributes. You can also manually modify the column attributes to include additional attributes for your own use. I believe the only other time the attributes dataset is updated is when the user resizes columns with the mouse.

Hello, thx for prompt reply
What do you mean by … ‘The column attributes dataset is constructed by the table customizer using the table data available at the time,’ - at what time ?
If I delete rows / columns in either the table’s dataset, or the attributes dataset, then they do not match.
In this case, how do I use scripting to change the ‘Horiz Align’ of the table’s columns, or change the column’s ‘Header’ value, or any other attribute ?
Thx again

The attributes dataset is optional. Entries in it for displayed columns are optional. Extra entries are ignored. If there’s a column in the table data that doesn’t have a row in the attributes dataset, the column will be displayed with default attributes.
At the time the designer uses the customizer, the attributes dataset is updated to include the table data columns, leaving any extra attributes alone.
If you need to adjust the attributes at client runtime, you’ll need to use the system.dataset.* script functions to create new rows or update individual cells.

Greetings All
Thx, Phil, for the discussion.
Phil, you said … ‘If you need to adjust the attributes at client runtime, you’ll need to use the system.dataset.* script functions to create new rows or update individual cells. …’
I do need to adjust the table’s ‘Column Attributes Data’ dataset at run time, because, at runtime, I have many datasets that I want to use with the table, depending on what options my users select - view by day, week, month, year, shift, deptno1, deptno2, …, and this adjustment of the attributes dataset will be done via scripting.
I can adjust the Column Attributes Data at runtime via scripting as long as the table’s Data property does not change. That means I can adjust name, date format, horiz align, etc of the columns that are available in the designer - this, I believe, is the same as me doing the changes in the designer, but at runtime. If, at runtime, I create a dataset & throw it at a table, I cannot use scripting functions to adjust attributes of columns that did not exist at design time. My question is … is this the case ?
I use a lot of database queries displayed as tables. If I cannot adjust column attributes at runtime for all possible user options then I have to determine each user option at design time & design separate tables for each option. This means I need 6 tables instead of 1, & maybe more windows to navigate about.
Thx again.
Steve

[quote=“steven hargraves”]I do need to adjust the table’s ‘Column Attributes Data’ dataset at run time, because, at runtime, I have many datasets that I want to use with the table, depending on what options my users select - view by day, week, month, year, shift, deptno1, deptno2, …, and this adjustment of the attributes dataset will be done via scripting.[/quote]Maybe not necessary. If a given column name has the same properties whenever it shows up, you don’t need scripting. Set it in the column attributes and forget it.[quote=“steven hargraves”]I can adjust the Column Attributes Data at runtime via scripting as long as the table’s Data property does not change.[/quote]No. The attributes dataset can be updated at any time independently from the table data. Rows in the attributes dataset that don’t match a table column will just sit there doing nothing.[quote=“steven hargraves”]If, at runtime, I create a dataset & throw it at a table, I cannot use scripting functions to adjust attributes of columns that did not exist at design time. My question is … is this the case ?[/quote]No. Just add rows to the attributes dataset with the column names you need.

Hello Phil
How do I add rows to the Column Attributes Data dataset with scripting?
I cannot even do this via the Dataset Viewer.
At the moment, when I change a table’s data proprety via a script, the table is updated, but the Column Attributes Data property remains unchanged until I open the table’s table customiser in the designer & click the OK button. This means that I at runtime I cannot search the Column Attributes Data dataset looking for my new column names that have appeared in the table.
Steve

[quote=“steven hargraves”]How do I add rows to the Column Attributes Data dataset with scripting?[/quote]As I’ve already said, using the system.dataset.* scripting functions. Untested sample code in a table’s property change event:if event.propertyName=='data': tempAttrs = event.source.columnAttributesData attrNameIdx = tempAttrs.getColumnIndex('name') anyChange = False for colName in event.source.data.columnNames: found = False for r in range(tempAttrs.rowCount): if colName==tempAttrs.getValueAt(r, attrNameIdx): found = True break if not found: newRow = [tempAttrs.getValueAt(0, c) for c in range(tempAttrs.columnCount)] newRow[attrNameIdx] = colName tempAttrs = system.dataset.addRow(tempAttrs, newRow) anyChange = True if anyChange: event.source.columnAttributesData = tempAttrsThat’ll duplicate the first row of the column attributes data into a new row with any new column name that shows up in the table data. It’s up to you to customize how each column is handled.[quote=“steven hargraves”]I cannot even do this via the Dataset Viewer.[/quote]Works for me. I have no idea what you are doing wrong.[quote=“steven hargraves”]At the moment, when I change a table’s data proprety via a script, the table is updated, but the Column Attributes Data property remains unchanged until I open the table’s table customiser in the designer & click the OK button. This means that I at runtime I cannot search the Column Attributes Data dataset looking for my new column names that have appeared in the table.[/quote]Right, just like I’ve described. You have to script runtime changes.
I’m starting to repeat myself here and you’re not getting anywhere. You’re probably making some simple mistake that I can’t see. If the above doesn’t help, consider opening a ticket with support so they can screen share with you.