PositionUnits Object Members in SuiteScript 2.1

PositionUnits object members offer key properties for defining a position in SuiteScript, enhancing workbook functionality.

·2 min read·View Oracle Docs

TL;DR Opening

The PositionUnits object in SuiteScript provides essential properties for defining a position with specific units and coordinates within a workbook. Understanding its members is crucial for effective script development.

What is the PositionUnits Object?

The PositionUnits object is used to define a position within a workbook using numeric values and associated units. It plays a significant role in various scripting contexts, particularly in the creation and manipulation of workbook elements.

PositionUnits Object Members

The following members are available within the workbook.PositionUnits object:

Member NameTypeReturn Type / Value TypeSupported Script TypesDescription
PositionUnits.unitstringstringServer scriptsThe units for the position.
PositionUnits.xnumbernumberServer scriptsThe x-coordinate of the position.
PositionUnits.ynumbernumberServer scriptsThe y-coordinate of the position.

How to Create a PositionUnits Object

To create a PositionUnits object, utilize the workbook.createPositionUnits(options) method:

suitescript
1// Example of creating a PositionUnits object
2var myPositionUnits = workbook.createPositionUnits({
3 unit: workbook.Unit.CM,
4 x: 3,
5 y: 3
6});

Important Properties

  • unit: The property PositionUnits.unit specifies the measurement units for the position. This is critical for ensuring that the position is defined correctly in the context of workbook dimensions.
  • x: Represents the horizontal position. It is denoted as a numeric value.
  • y: Represents the vertical position. It is also a numeric value.

Error Handling

Be mindful of the potential errors when working with the PositionUnits object:

  • INVALID_UNIT: Thrown if the specified value for unit is not included in the workbook.Unit enumeration.
  • WRONG_PARAMETER_TYPE: This occurs if the value specified is not of string type for the unit property.

Who This Affects

This information is particularly relevant for:

  • Developers who are working with SuiteScript for custom workbook implementations.
  • Administrators managing and scripting around workbook functionalities in NetSuite.

Key Takeaways

  • The PositionUnits object is vital for defining positions within a workbook.
  • It includes properties for units of measure, as well as x and y coordinates.
  • Proper understanding and implementation can significantly enhance workbook functionality within SuiteScript.

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

Frequently Asked Questions (4)

What are the main components of the PositionUnits object in SuiteScript 2.1?
The PositionUnits object includes three main members: `PositionUnits.unit` for specifying measurement units, `PositionUnits.x` for the x-coordinate, and `PositionUnits.y` for the y-coordinate. All these properties are applicable for server scripts.
How do I create a PositionUnits object using SuiteScript 2.1?
To create a PositionUnits object, use the `workbook.createPositionUnits(options)` method, providing the `unit`, `x`, and `y` properties. An example includes setting `unit` to a value from `workbook.Unit`, and coordinates `x` and `y` to numeric values.
What error might I encounter if I provide an unsupported unit in a PositionUnits object?
If an unsupported unit is specified in a PositionUnits object, you may encounter an `INVALID_UNIT` error, indicating that the unit is not part of the `workbook.Unit` enumeration.
Are there any script types where the PositionUnits object can be used?
Yes, the PositionUnits object can specifically be used within server scripts, as mentioned for its properties like `unit`, `x`, and `y`.
Source: PositionUnits 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 →