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
- Common SuiteScript Errors and Solutions for NetSuite
Common NetSuite script errors include INVALID_SCRIPT_DEPLOYMENT_ID and SSS_AUTHORIZATION_HEADER_NOT_ALLOWED. Learn effective solutions.
- Set Sublist Field Values in SuiteScript 2.x for Record Management
Set sublist field values in SuiteScript 2.x for effective record management using standard and dynamic modes.
- Setting Field Values in SuiteScript for Effective Record
Learn to set field values in SuiteScript effectively, troubleshooting common errors and understanding data types.
- SuiteScript 2.1 Enhancements and API Updates in NetSuite
SuiteScript 2.1 enables execution of 2.0 scripts and supports PATCH method for enhanced API capabilities.
Advertising
Reach SuiteScript Professionals
Put your product in front of NetSuite experts who work with SuiteScript every day.
Sponsor This Category