Column Object Members
Explore the available members of the Column object in SuiteScript, enhancing query functionality for NetSuite API users.
The query.Column object in SuiteScript provides crucial members for defining query result columns in NetSuite. Understanding these members is essential for developers who want to effectively retrieve and manipulate data through queries.
What Are Column Object Members?
Column object members allow you to customize query definitions significantly. Each member of a query.Column provides different capabilities, enhancing how data is aggregated, displayed, and managed within your scripts.
Column Object Members
The following table summarizes the members available for a query.Column object:
| Member Name | Type | Supported Script Types | Description |
|---|---|---|---|
Column.aggregate | string (read-only) | Client and server scripts | An aggregate function that performs calculations on column values, returning a single result. |
Column.alias | string (read-only) | Client and server scripts | An alternate name for a column used in mapped results. |
Column.component | query.Component (read-only) | Client and server scripts | References the query.Component object associated with this column. |
Column.context | Object (read-only) | Client and server scripts | Determines the field context for displayed values in the column. |
Column.fieldId | string (read-only) | Client and server scripts | The identifier for the query result column; cannot be set simultaneously with the Column.formula property. |
Column.formula | string (read-only) | Client and server scripts | The formula used to generate the query result column; cannot be set simultaneously with Column.fieldId. |
Column.groupBy | (read-only) | Client and server scripts | Indicates whether the results are grouped by this column. |
Column.label | string (read-only) | Client and server scripts | The display label for the column. |
Column.type | string (read-only) | Client and server scripts | Indicates the return type of the formula for the column. |
How to Create Columns
To create columns in your queries, you can utilize the following methods:
- Use
Query.createColumn(options)to create a column in a standard query definition. - Use
Component.createColumn(options)for columns in join relationships created withQuery.autoJoin(options)orComponent.autoJoin(options).
It is essential to assign all created columns to the Query.columns property to ensure they are recognized during execution.
Example Syntax
Here’s a basic example of how to define a query and utilize column members:
1var myCustomerQuery = query.create({2 type: query.Type.CUSTOMER3});4var myAggColumn = myCustomerQuery.createColumn({5 fieldId: 'amount',6 aggregate: query.Aggregate.AVERAGE7});8myCustomerQuery.columns = [myAggColumn];9var theAggregate = myAggColumn.aggregate;Important Note
Including at least one query.Column in your query definition is critical to avoid scripting errors. Although it is an optional parameter when using the query.create(options) method, a Column object must be present for each query definition.
Who This Affects
This content is particularly relevant for:
- Developers: Implement and manage queries effectively.
- Administrators: Understand how to customize and extend data retrieval processes in NetSuite.
Key Takeaways
- The
query.Columnobject is vital for querying data in SuiteScript. - Multiple members provide functionalities for aggregation, aliases, and data context.
- Properly defining columns helps in error prevention and enhances query performance.
Frequently Asked Questions (4)
Can a single column in a NetSuite query have both a formula and a fieldId set?
How do I ensure my query columns are recognized during execution in SuiteScript?
Are the column members applicable for both client and server side scripts?
Is it necessary to include a 'query.Column' object in every query definition?
Was this article helpful?
More in General
- Payment Date Prediction Feature in NetSuite
Payment Date Prediction in NetSuite utilizes machine learning to enhance financial planning by predicting invoice payment dates.
- NetSuite Ship Central Enhancements for Packing & Shipping
NetSuite Ship Central features enhance packing and shipping operations for improved efficiency and accuracy.
- New Role Setup for NetSuite AI Connector Service in 2026.1
The 2026.1 release adds a new role requirement for the NetSuite AI Connector Service, streamlining custom tool development.
- Generative AI Features in NetSuite 2026.1
Discover new generative AI features in NetSuite 2026.1, enhancing reporting, search, predictions, and development productivity.
Advertising
Reach General Professionals
Put your product in front of NetSuite experts who work with General every day.
Sponsor This Category