Aspect Object Members in SuiteScript for Workbook API
Aspect object members in SuiteScript define measures and types within the Workbook API for effective data handling.
TL;DR Opening
The Aspect object members in SuiteScript facilitate the handling of data measures and types within the Workbook API, enhancing scripting flexibility and data interaction. Understanding these properties is crucial for effective script development.
What is the Aspect Object?
The Aspect object is part of the Workbook API, which allows developers to create and manipulate data visualizations directly in SuiteScript. By utilizing the Aspect object, you can define specific data measures and types necessary for your workbook operations.
What Members Does the Aspect Object Include?
The Aspect object includes several key members:
| Member Name | Type | Return Type / Value Type | Supported Script Types | Description |
|---|---|---|---|---|
| Aspect.measure | workbook.CalculatedMeasure or workbook.DataMeasure | Measure of the aspect. | Server scripts | Represents the measurement aspect of the object. |
| Aspect.type | string | The type of the aspect. | Server scripts | Specifies the kind of aspect using workbook.AspectType. |
Syntax for Creating an Aspect
To create an Aspect object, you can utilize the following code structure, which highlights both basic and complete examples:
1// Create a basic Aspect2var myAspect = workbook.createAspect({3 measure: myMeasure,4});5 6// Create a complete Aspect7var myAspect = workbook.createAspect({8 measure: myMeasure,9 type: workbook.AspectType.COLOR10});How to Access Aspect Members
After creating an Aspect object, it’s possible to access its various properties, as shown here:
1// Load a workbook and view an aspect in a Chart2var myWorkbook = workbook.load({3 id: myWorkbookId4});5var myAspect = myWorkbook.charts[0].series[0].aspect[0];6 7log.audit({8 title: 'Aspect type = ',9 details: myAspect.type10});11log.audit({12 title: 'Aspect measure = ',13 details: myAspect.measure14});Error Handling
When working with the Aspect members, be aware of the following error code that may be thrown:
- WRONG_PARAMETER_TYPE: This error occurs if the provided value for
Aspect.measureis not of typeworkbook.CalculatedMeasureorworkbook.DataMeasure.
Who This Affects
- Developers: Ensures they can effectively utilize the Workbook API to create dynamic reports.
- Administrators: Assists in managing workbook creation and data visualization tasks efficiently.
Key Takeaways
- The Aspect object enhances data handling within the SuiteScript Workbook API.
- Key properties include
measureandtype, defining how data is represented. - Error handling is crucial for preventing incorrect data types during variable assignments.
Frequently Asked Questions (4)
What script types support the Aspect object in SuiteScript?
What error might occur when working with Aspect.measure, and how can it be avoided?
Can an Aspect object have both measure and type properties defined?
How do I access an Aspect object's properties in a SuiteScript workbook?
Was this article helpful?
More in SuiteScript
- Common SuiteScript Errors and Solutions for NetSuite
Common NetSuite script errors include INVALID_SCRIPT_DEPLOYMENT_ID and SSS_AUTHORIZATION_HEADER_NOT_ALLOWED. Learn effective solutions.
- Set Sublist Field Values in SuiteScript 2.x for Record Management
Set sublist field values in SuiteScript 2.x for effective record management using standard and dynamic modes.
- Setting Field Values in SuiteScript for Effective Record
Learn to set field values in SuiteScript effectively, troubleshooting common errors and understanding data types.
- SuiteScript 2.1 Enhancements and API Updates in NetSuite
SuiteScript 2.1 enables execution of 2.0 scripts and supports PATCH method for enhanced API capabilities.
Advertising
Reach SuiteScript Professionals
Put your product in front of NetSuite experts who work with SuiteScript every day.
Sponsor This Category