Columns
Columns in a dataset represent the record fields that you want to include in the dataset query results. If you want to use the data in a particular field in a workbook visualization, the underlying dataset must include a column for that field.
For more information about the types of fields you can create columns for in SuiteAnalytics Workbook, see Formula Fields and Hierarchical Fields.
To create a column, use dataset.createColumn(options). This method creates a dataset.Column object. You can create a column using the following combinations of required parameters:
-
fieldId
– The field to use for the column.var myColumn = dataset.createColumn({ fieldId: 'email' });
-
formula
andtype
– A formula and the formula type to use for the column.var myColumn = dataset.createColumn({ formula: '{email}', type: 'STRING' });
Optionally, you can provide the following parameters for dataset.createColumn(options):
-
alias
– An alias for the column. You can use this alias to get an expression for the column to use in a workbook. Aliases can contain only letters, numbers, and underscores. For more information, see Expressions. -
join
– The joined record on which the field is present. Use dataset.createJoin(options) to create joins. For more information, see Joins. -
id
– A script ID for the column. You can use this ID to get an expression for the column to use in a workbook, similar to thealias
parameter. -
label
– A label for the column to display in the UI.
var myColumn = dataset.createColumn({
alias: 'Email Column',
fieldId: 'email',
join: myJoin,
id: 'customscript_myColumn',
label: 'Email Column'
});