workbook.createMeasure(options)
Method Description |
Creates a measure, which includes an aggregation, a label, and one or more expressions. |
Returns |
|
Supported Script Types |
Server scripts For more information, see SuiteScript 2.x Script Types. |
Governance |
None |
Module |
|
Sibling Module Members |
|
Since |
2020.2 |
Parameters
The options
parameter is a JavaScript object.
Parameter |
Type |
Required / Optional |
Description |
---|---|---|---|
|
string |
optional |
The aggregation of the measure. |
|
required if |
A single expression for the measure (if this is a single expression measure). |
|
|
required if |
A set of expressions for the measure (if this is a multi expression measure). |
|
|
string |
optional |
The label of the measure. |
Errors
Error Code |
Thrown If |
---|---|
|
The |
|
Both the |
Syntax
The following code sample shows the syntax for this member. It is not a functional example. For a complete script example, see N/workbook Module Script Samples. Also see Full scripts in the Tutorial: Creating a Workbook Using the Workbook API topic.
// Add additional code
...
// Create a basic single expression Measure
var myMeasure = workbook.createMeasure({
expression: myExpression
});
// Create a basic multi-expression Measure
var myMeasure = workbook.createMeasure({
expressions: [myExpression]
});
// Create a comprehensive single expression Measure
var myMeasure = workbook.createMeasure({
label: 'My Measure',
aggregation: workbook.Aggregation.MEDIAN,
expression: myExpression
});
// Create a comprehensive multi-expression Measure
var myMeasure = workbook.createMeasure({
label: 'My Measure',
aggregation: workbook.Aggregation.SUM,
expressions: [myExpression]
});
...
// Add additional code