Pivots
Pivots let you analyze different subsets of your dataset query results using analytical features such as data dimensions, measures, filters, and report styles. You can only create pivots using fields that have been added to the underlying dataset.
For more information about pivots in SuiteAnalytics Workbook, see Workbook Pivot Tables.
To create a pivot, use workbook.createPivot(options). This method creates a workbook.Pivot object. When you use this method, you must provide the following parameters:
-
columnAxis
– The column axis for the pivot. Use workbook.createPivotAxis(options) to create axes. For more information, see Pivot Axes. -
dataset
ordatasetLink
– The underlying dataset or linked dataset for the pivot. You can provide either a dataset (using thedataset
parameter) or a linked dataset (using thedatasetLink
parameter), but you cannot provide both at the same time. For more information, see Datasets and Dataset Linking. -
id
– A script ID for the pivot. You can provide this ID to Workbook.runPivot(options) to obtain the results of the pivot. -
name
– A name for the pivot.
var myPivot = workbook.createPivot({
columnAxis: myColumnAxis,
dataset: myDataset,
id: 'MyPivot',
name: 'My Pivot',
rowAxis: myRowAxis
});
Optionally, you can provide the following parameters for workbook.createPivot(options):
-
aggregationFilters
– A set of conditional filters or limiting filters that are applied to the pivot. Use workbook.createConditionalFilter(options) to create conditional filters, and use workbook.createLimitingFilter(options) to create limiting filters. For more information about filters in SuiteAnalytics Workbook, see Workbook Visualization Filters. -
filterExpressions
– A set of simple, non-aggregated value-based filters for the pivot. You provide these filters as a set of workbook.Expression objects. Use workbook.createExpression(options) to create these expressions. For more information, see Expressions. -
portletName
– A name for the pivot when it is displayed as a portlet in NetSuite. -
reportStyles
– A set of report styles for the pivot. Use workbook.createReportStyle(options) to create report styles. For more information, see Styles.
var myPivot = workbook.createPivot({
aggregationFilters: myAggregationFilters,
columnAxis: myColumnAxis,
dataset: myDataset,
filterExpressions: myFilterExpressions,
id: 'MyPivot',
name: 'My Pivot',
portletName: 'My Pivot as a Portlet',
reportStyles: [myFirstReportStyle, mySecondReportStyle],
rowAxis: myRowAxis
});