workbook.createReportStyleRule(options)

Method Description

Creates a report style formatting rule.

Returns

workbook.ReportStyleRule

Supported Script Types

Server scripts

For more information, see SuiteScript 2.x Script Types.

Governance

None

Module

N/workbook Module

Sibling Module Members

N/workbook Module Members

Since

2021.2

Parameters

Note:

The options parameter is a JavaScript object.

Parameter

Type

Required / Optional

Description

options.expression

workbook.Expression

required

An expression indicating when the report style rule should be applied.

options.style

workbook.Style

required

The style to use for the report style rule.

Syntax

Important:

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 the report style rule using previously created workbook objects
var myReportStyleRule = workbook.createReportStyleRule({
    expression: myExpression,  // previously created workbook.Expression object
    style: myReportStyle       // previously created workbook.Style object
});

// defining parameters as part of creating the style rule
 var rule = workbook.createReportStyleRule({
     expression: workbook.createExpression({
         functionId: workbook.ExpressionType.COMPARE,
         parameters: {
             comparisonType: "GREATER_OR_EQUAL",
             operand1: workbook.createExpression({
                 functionId: workbook.ExpressionType.MEASURE_VALUE,
                 parameters: {
                     measure: calculatedMeasure  // previously created workbook.CalculatedMeasure
                 }
             }),
             operand2: workbook.createConstant(workbook.createCurrency({
                 amount: 1,
                 id: "USD"})
             )
         }
    }),
    style: workbook.createStyle({
        backgroundColor: workbook.createColor({
            red: 255,
            green: 192,
            blue: 203
        })
    })
});
...
// Add additional code 

          

Related Topics

General Notices