ReportStyleRule Object Members in SuiteScript Documentation

Understand the ReportStyleRule object members in SuiteScript, including expression and style properties for report customization.

·2 min read·View Oracle Docs

The ReportStyleRule object in SuiteScript is integral for customizing report styles within the NetSuite environment. This object allows developers to define rules that determine when and how specific styles are applied to reports, enhancing the clarity and visual appeal of data presentations.

What is the ReportStyleRule Object?

The ReportStyleRule serves as a framework for creating conditional styles for reports. By utilizing this object, developers can control the styling of report elements based on certain boolean expressions, ensuring that reports remain both informative and visually organized.

How to Create a ReportStyleRule

To instantiate a ReportStyleRule, use the workbook.createReportStyleRule(options) method. This method requires specific parameters that define the conditions under which styles will be applied to report elements.

ReportStyleRule Members

The following members are part of the ReportStyleRule object:

Member NameTypeDescription
ReportStyleRule.expressionworkbook.ExpressionA boolean expression indicating whether the style should be applied.
ReportStyleRule.styleworkbook.StyleSpecifies the style to be applied to the report.

Code Sample

Here’s a basic syntax example of how to create a ReportStyleRule within a script:

suitescript
1// Define expressions and styles beforehand.
2var myExpression = ...; // Must be a workbook.Expression object
3var myReportStyle = ...; // Must be a workbook.Style object
4
5// Create the ReportStyleRule object
6var myReportStyleRule = workbook.createReportStyleRule({
7 expression: myExpression,
8 style: myReportStyle
9});

This code snippet demonstrates creating a ReportStyleRule object named myReportStyleRule using previously defined expression and style objects. This approach is crucial for setting dynamic styling in reports based on conditions defined in your application logic.

Supported Script Types

The ReportStyleRule object is supported in server-side scripts, making it versatile for various reporting needs in SuiteScript development.

Error Handling

Ensure that the parameters passed for expression and style are indeed of the correct types, as passing incorrect types can result in errors. Specifically, an error with the code WRONG_PARAMETER_TYPE will be thrown if the specified property types do not match the required object types.

Who This Affects

  • Developers: Those creating custom reports using SuiteScript.
  • Administrators: Users managing report configurations within NetSuite.

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

Key Takeaways

  • The ReportStyleRule object allows conditional styling of reports.
  • Key members include expression and style, critical for defining how styles are applied.
  • Proper understanding of types is necessary to avoid parameter errors during implementation.

Frequently Asked Questions (4)

Is the ReportStyleRule object available in client-side scripts?
No, the ReportStyleRule object is supported in server-side scripts, allowing for customization of report styles within SuiteScript.
What object type must the expression parameter be when creating a ReportStyleRule?
The expression parameter must be a workbook.Expression object to correctly evaluate whether a style should be applied.
What happens if incorrect parameter types are passed to the createReportStyleRule method?
If incorrect parameter types are passed, an error with the code WRONG_PARAMETER_TYPE will be thrown, indicating a mismatch in the expected object types.
Can custom styles be conditionally applied to report elements using the ReportStyleRule object?
Yes, the ReportStyleRule object allows developers to apply styles conditionally to report elements based on boolean expressions, enabling dynamic styling in reports.
Source: ReportStyleRule 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 General

View all General articles →