DataMeasure Object Members in SuiteScript Reference

The DataMeasure object in SuiteScript allows defining data measures with properties like aggregation and labels for custom analytics.

·2 min read·View Oracle Docs

The DataMeasure object in SuiteScript provides a structured way to define data measures used within the workbook functionality of NetSuite. This object allows developers to utilize properties that detail the aggregation method, the expression, and labels associated with these measures.

Overview of DataMeasure Properties

The following table outlines the members of the workbook.DataMeasure object:

Property NameReturn TypeSupported Script TypesDescription
DataMeasure.aggregationstringServer scriptsDefines the aggregation method for the data measure.
DataMeasure.expressionworkbook.ExpressionServer scriptsThe single expression for the data measure.
DataMeasure.expressionsworkbook.Expression[]Server scriptsAn array of expressions for multiple-expression measures.
DataMeasure.label`stringworkbook.Expression`Server scripts

Creating a DataMeasure Object

To create a DataMeasure object, the workbook.createDataMeasure(options) method is used. This method requires the following options:

  • aggregation: The method of aggregation (e.g., DataCount).
  • expression: A previously created workbook.Expression object, denoting the data used for calculations.
  • label: A descriptive label for the measure.

Here is a sample syntax for creating a DataMeasure:

suitescript
1// Add additional code
2...
3// myDataMeasure is a workbook.DataMeasure object
4
5var myDataMeasure = workbook.createDataMeasure({
6 aggregation: 'DataCount',
7 expression: singleExpression, // previously created workbook.Expression
8 label: 'MeasureLabel'
9});
10...
11// Add additional code

Supported Module

The DataMeasure object is part of the N/workbook Module, which provides various functionalities for manipulating workbook objects within SuiteScript.

Error Handling

It's important to manage potential errors when interacting with the DataMeasure object. Some common error codes include:

  • INVALID_AGGREGATION: Thrown if the specified aggregation value is not part of the workbook.Aggregation enum.
  • WRONG_PARAMETER_TYPE: Thrown when the data type provided does not match the expected type (e.g., a string).

Key Considerations

  • Ensure that expressions defined in DataMeasure follow the correct formatting and data types to avoid runtime errors.
  • Familiarize yourself with the N/workbook Module for effective utilization of the DataMeasure object capabilities.

Source: This article is based on Oracle's official NetSuite documentation.

Key Takeaways

  • The DataMeasure object helps define data measures for analytics in SuiteScript.
  • Key properties include aggregation, expression, and label.
  • Proper error handling is essential for maintaining data integrity and functionality in scripts.

Frequently Asked Questions (4)

How can I create a DataMeasure object in SuiteScript?
To create a DataMeasure object, use the workbook.createDataMeasure(options) method, specifying options like aggregation, expression, and label.
What script types support the DataMeasure properties?
The DataMeasure properties are supported in server scripts.
What are some common errors when using the DataMeasure object?
Common errors include INVALID_AGGREGATION if the aggregation method is not valid, and WRONG_PARAMETER_TYPE if the data type does not match expectations.
Which module in SuiteScript includes the DataMeasure object?
The DataMeasure object is part of the N/workbook Module in SuiteScript.
Source: DataMeasure 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 →