TableColumn Object Members for SuiteScript Workbook Module

The TableColumn object in SuiteScript offers customizable properties for designing table columns within workbooks.

·3 min read·View Oracle Docs

The TableColumn object serves as a fundamental component when defining tables in SuiteScript. With various properties and methods, it allows developers to customize table column behavior effectively.

What is the TableColumn Object?

The TableColumn object is utilized to create a table column definition within the SuiteScript workbook module. Developers can use the workbook.createTableColumn(options) function to generate this object and utilize it in the workbook.createTable(options) for various table management tasks.

TableColumn Object Members

The following members are available for a workbook.TableColumn object:

Member NameTypeDescription
TableColumn.aliasstringThe alias for the table column.
TableColumn.datasetColumnAliasstringThe alias of the dataset column from which the table column was created.
TableColumn.fieldContextworkbook.FieldContextDefines the field context used in the table column.
TableColumn.filtersworkbook.TableColumnFilterThe filters applied to the table column.
TableColumn.labelstringThe label assigned to the table column.
TableColumn.sortworkbook.SortSpecifies the sorting behavior for the column.
TableColumn.widthnumberDesired width of the table column in the UI.

Creating a TableColumn

Here’s how to create a TableColumn object with different properties:

suitescript
1// Create a basic TableColumn
2var myTableColumn = workbook.createTableColumn({
3 sort: mySort,
4 datasetColumnAlias: myDatasetColumnId
5});
6
7// Create a TableColumn with filters
8var myTableColumn = workbook.createTableColumn({
9 filters: [myTableFilter],
10 sort: mySort,
11 datasetColumnAlias: myDatasetColumnId
12});
13
14// Create a full TableColumn
15var myTableColumn = workbook.createTableColumn({
16 filters: [myTableFilter],
17 width: 50,
18 datasetColumnAlias: 'Column7',
19 fieldContext: myFieldContext,
20 label: 'My Complex Table Column',
21 alias: 'myComplexTableColumn',
22 sort: mySort
23});

Retrieving TableColumn Properties

Developers can access the properties of a table column as follows:

suitescript
1// Load a workbook
2var myWorkbook = workbook.load ({
3 id: myWorkbookId
4});
5
6// Access the first column in the first table
7var myTableColumn = myWorkbook.tables[0].columns[0];
8
9// Log the properties
10log.audit({
11 title: 'TableColumn.datasetColumnAlias = ',
12 details: myTableColumn.datasetColumnAlias
13});
14
15log.audit({
16 title: 'TableColumn.sort = ',
17 details: myTableColumn.sort
18});
19
20log.audit({
21 title: 'TableColumn.filters = ',
22 details: myTableColumn.filters
23});

Supported Script Types

The TableColumn object and its members are available in Server scripts, allowing for flexible and powerful workbook manipulation through SuiteScript.

Error Handling

If there is an issue with the type of a value being set for a property, the WRONG_PARAMETER_TYPE error code is thrown, indicating the value is not of the expected type. For example, the TableColumn.alias property must be a string.

Who This Affects

  • Developers: Those creating or managing SuiteScript applications that involve data representation in a tabular format.
  • Administrators: Users who oversee SuiteScript implementations in their organization’s NetSuite environment.

Key Takeaways

  • The TableColumn object provides customizable properties for defining table columns in SuiteScripts.
  • Several members facilitate filtering, sorting, and aliasing, greatly enhancing data representation.
  • Error handling is essential for ensuring correct property assignments in scripts.

Frequently Asked Questions (4)

How do I create a TableColumn with filters in SuiteScript?
You can create a TableColumn with filters using the `workbook.createTableColumn` method and passing an object with the `filters` property. For example: `workbook.createTableColumn({ filters: [myTableFilter], ... })`.
What happens if the wrong type is assigned to a TableColumn property?
Assigning a value of the wrong type to a TableColumn property will result in a `WRONG_PARAMETER_TYPE` error. This indicates that the value provided does not match the expected type, such as providing a non-string value to the `TableColumn.alias` property.
Can the TableColumn object be used in client scripts, or is it server-side only?
The TableColumn object and its members are available for use in Server scripts only, allowing for flexible workbook manipulation through SuiteScript on the server side.
What is the role of the TableColumn.fieldContext property?
The `TableColumn.fieldContext` property defines the field context used in the table column. It helps in managing how data is presented within the table column effectively.
Source: TableColumn Object Members Oracle NetSuite Help Center. This article was generated from official Oracle documentation and enriched with additional context and best practices.

Was this article helpful?

More in Integration

View all Integration articles →