TableColumn Object Members for SuiteScript Workbook Module
The TableColumn object in SuiteScript offers customizable properties for designing table columns within workbooks.
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 Name | Type | Description |
|---|---|---|
TableColumn.alias | string | The alias for the table column. |
TableColumn.datasetColumnAlias | string | The alias of the dataset column from which the table column was created. |
TableColumn.fieldContext | workbook.FieldContext | Defines the field context used in the table column. |
TableColumn.filters | workbook.TableColumnFilter | The filters applied to the table column. |
TableColumn.label | string | The label assigned to the table column. |
TableColumn.sort | workbook.Sort | Specifies the sorting behavior for the column. |
TableColumn.width | number | Desired width of the table column in the UI. |
Creating a TableColumn
Here’s how to create a TableColumn object with different properties:
1// Create a basic TableColumn2var myTableColumn = workbook.createTableColumn({3 sort: mySort,4 datasetColumnAlias: myDatasetColumnId5});6 7// Create a TableColumn with filters8var myTableColumn = workbook.createTableColumn({9 filters: [myTableFilter],10 sort: mySort,11 datasetColumnAlias: myDatasetColumnId12});13 14// Create a full TableColumn15var 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: mySort23});Retrieving TableColumn Properties
Developers can access the properties of a table column as follows:
1// Load a workbook2var myWorkbook = workbook.load ({3 id: myWorkbookId4});5 6// Access the first column in the first table7var myTableColumn = myWorkbook.tables[0].columns[0];8 9// Log the properties10log.audit({11 title: 'TableColumn.datasetColumnAlias = ',12 details: myTableColumn.datasetColumnAlias13});14 15log.audit({16 title: 'TableColumn.sort = ',17 details: myTableColumn.sort18});19 20log.audit({21 title: 'TableColumn.filters = ',22 details: myTableColumn.filters23});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?
What happens if the wrong type is assigned to a TableColumn property?
Can the TableColumn object be used in client scripts, or is it server-side only?
What is the role of the TableColumn.fieldContext property?
Was this article helpful?
More in SuiteScript
- SuiteScript 2.1 Enhancements in NetSuite February Updates
SuiteScript 2.1 now supports async features and PATCH method. Discover the latest API and SuiteProcurement improvements.
- Scheduling Map/Reduce Script Deployments in NetSuite
Learn to schedule map/reduce script submissions, including one-time and recurring options in NetSuite.
- Binary File Support in N/https Module for SuiteScript
SuiteScript enhances capabilities with binary file support in the N/https module, allowing improved data handling in external communications.
- API Governance Units Calculation in NetSuite 2026.1
NetSuite 2026.1 introduces examples illustrating API governance unit calculations for both user event and scheduled scripts.
