PivotAxis Object Members in SuiteScript for Data Analysis

The PivotAxis object in SuiteScript enables dynamic data analysis via customizable pivot definitions for enhanced reporting.

·2 min read·View Oracle Docs

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 NameReturn Type / Value TypeSupported Script TypesDescription
PivotAxis.rootworkbook.DataDimension ` workbook.Section`Server scripts
PivotAxis.sortDefinitionsworkbook.SortDefinition[]Server scriptsDefines the sorting options for the pivot axis.

Using the PivotAxis Object

To create a PivotAxis object, use the following method:

suitescript
// Syntax to create a basic PivotAxis
var myPivotAxis = workbook.createPivotAxis({
root: myDataDimension // or mySection
});

You can also define sort orders by using sortDefinitions:

suitescript
// Creating a sorted PivotAxis
var myPivotAxis = workbook.createPivotAxis({
root: mySection,
sortDefinitions: [mySortDefinition]
});

Accessing Properties

This object’s properties can be accessed as follows:

suitescript
1// Loading a workbook
2var myWorkbook = workbook.load({ id: myWorkbookId });
3log.audit({
4 title: 'PivotAxis root = ',
5 details: myWorkbook.pivots[0].rowAxis.root
6});
7log.audit({
8 title: 'PivotAxis sortDefinitions = ',
9 details: myWorkbook.pivots[0].rowAxis.sortDefinitions
10});

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 PivotAxis object 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?
The PivotAxis.root returns either a workbook.DataDimension or a workbook.Section, designed for server scripts.
How do I define a sort order for a PivotAxis object?
You can define a sort order for a PivotAxis object using the sortDefinitions property, which takes an array of workbook.SortDefinition objects.
What error might occur if the wrong type is provided for PivotAxis.root?
An error with the code WRONG_PARAMETER_TYPE will occur if the value provided for PivotAxis.root is not a workbook.DataDimension or a workbook.Section.
Is the PivotAxis object available for server-side scripts only?
Yes, the members of the PivotAxis object, such as root and sortDefinitions, are designed to be used with server scripts.
Source: PivotAxis Object Members Oracle NetSuite Help Center. This article was generated from official Oracle documentation and enriched with additional context and best practices.

Was this article helpful?

More in Platform

View all Platform articles →