workbook.createTableColumn(options)

Note:

The content in this help topic applies to SuiteScript 2.x.

Method Description

Creates a table column. Table columns are used in table definitions, and include an alias, dataset column alias/ID, filters, a label, sorts, and a column width.

Returns

workbook.TableColumn

Supported Script Types

Server scripts

For more information, see SuiteScript 2.x Script Types.

Governance

None

Module

N/workbook Module

Sibling Module Members

N/workbook Module Members

Since

2020.2

Parameters

Note:

The options parameter is a JavaScript object.

Parameter

Type

Required / Optional

Description

options.alias

string

optional

The alias for the table column. The alias can be used for mapping results.

options.condition

workbook.TableColumnCondition

optional

Additional conditions for the table column.

options.conditionalFormats

workbook.ConditionalFormat[]

required

The conditional formatting to apply to the table column.

options.datasetColumnAlias

string

required

The alias of the underlying dataset column.

options.label

string | workbook.Expression

optional

The label for the table column.

options.sort

workbook.Sort

optional

The sorting behavior for the table column.

options.width

number

optional

The width of the table column in the UI, in pixels.

Syntax

Important:

The following code sample shows the syntax for this member. It is not a functional example. For a complete script example, see N/workbook Module Script Samples.

            // Add additional code
...
// Create a basic TableColumn
var myTableColumn = workbook.createTableColumn({
    datasetColumId: 1,
    sort: mySort
});

// Create a TableColumn with filters
var myTableColumn = workbook.createTableColumn({
    datasetColumId: 1,
    filters: [myTableFilter],
    sort: mySort
});

// Create a complex TableColumn
var myTableColumn = workbook.createTableColumn({
    filters: [myTableFilter],
    width: 50,
    datasetColumnId: 7,
    fieldContext: myFieldContext,
    label: 'My Complex Table Column',
    alias: 'myComplexTableColumn',
    sort: mySort
});
...
// Add additional code 

          

Related Topics

N/workbook Module
SuiteScript 2.x Modules
SuiteScript 2.x

General Notices