Columns
In a dataset, columns show the record fields you want to include in your query results. To use a field in a workbook visualization, it needs to be included as a column in the underlying dataset.
For more information about the types of fields you can create columns for in SuiteAnalytics Workbook, see Formula Fields and Hierarchical Fields.
You can create a column using 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' });
You can also provide these 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'
});