PivotAxis Object Members in SuiteScript for Data Analysis
The PivotAxis object in SuiteScript enables dynamic data analysis via customizable pivot definitions for enhanced reporting.
The PivotAxis object is crucial for data analysis in SuiteScript, allowing developers to create customizable pivot definitions for generating advanced reporting insights. This object can represent either a data dimension or a section, which are specifically designed to facilitate complex data manipulations and visualizations.
What Are PivotAxis Object Members?
Member Overview
The following members are available for the workbook.PivotAxis object:
| Member Name | Return Type / Value Type | Supported Script Types | Description |
|---|---|---|---|
PivotAxis.root | workbook.DataDimension ` | workbook.Section` | Server scripts |
PivotAxis.sortDefinitions | workbook.SortDefinition[] | Server scripts | Defines the sorting options for the pivot axis. |
Using the PivotAxis Object
To create a PivotAxis object, use the following method:
// Syntax to create a basic PivotAxisvar myPivotAxis = workbook.createPivotAxis({ root: myDataDimension // or mySection});You can also define sort orders by using sortDefinitions:
// Creating a sorted PivotAxisvar myPivotAxis = workbook.createPivotAxis({ root: mySection, sortDefinitions: [mySortDefinition]});Accessing Properties
This object’s properties can be accessed as follows:
1// Loading a workbook2var myWorkbook = workbook.load({ id: myWorkbookId });3log.audit({4 title: 'PivotAxis root = ',5 details: myWorkbook.pivots[0].rowAxis.root6});7log.audit({8 title: 'PivotAxis sortDefinitions = ',9 details: myWorkbook.pivots[0].rowAxis.sortDefinitions10});Error Handling
When utilizing the PivotAxis.root, it is critical to ensure that the provided value is either a workbook.DataDimension or a workbook.Section. The code will throw an error if the type is incorrect:
- Error Code:
WRONG_PARAMETER_TYPE- Thrown If: The value specified for this property does not align with the accepted types.
Who This Affects
- Developers: Particularly those working on data analysis and reporting in SuiteScript.
- Administrators: Involved in setting up or customizing reports that utilize pivot definitions.
Key Takeaways
- The
PivotAxisobject allows for flexible data representation in SuiteScript. - Custom sort definitions can enhance report clarity and relevance.
- Understanding property types is essential to avoid parameter errors during implementation.
Frequently Asked Questions (4)
What are the return types for PivotAxis.root in SuiteScript?
How do I define a sort order for a PivotAxis object?
What error might occur if the wrong type is provided for PivotAxis.root?
Is the PivotAxis object available for server-side scripts only?
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.
