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.
Source: This article is based on Oracle's official NetSuite documentation.
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 Platform
- Style Object Members for Workbook API in NetSuite
The Style object provides customizable properties for workbook formatting in NetSuite, enhancing report and visualization functionality.
- Asynchronous HTTP Requests with SuiteScript Promises
Use SuiteScript to send asynchronous HTTP requests with promises for efficient error handling and response processing.
- Setting Sublist Field Values in SuiteScript
Set values for sublist fields in SuiteScript using the setSublistValue method. Understand required parameters and error handling.
- In This Help Topic
Explore N/log module guidelines, log levels, and script execution logs for efficient logging in SuiteScript.
Advertising
Reach Platform Professionals
Put your product in front of NetSuite experts who work with Platform every day.
Sponsor This Category