Query object method · N/query

createColumn()

Query.createColumn(options)

Creates a query result column based on the query.Query object.

Implementation
Not started used inside other constructs
Design
Open for proposals suggest how it should read
Proposals
A
Signature
Query.createColumn(options)
Module
N/query
Returns
query.Column
Governance
None
Script types
Client and server scripts
Version
SuiteScript 2.x, documented for 2.1; since NetSuite 2018.1
call shapefrom Oracle's parameter table
1objQuery.createColumn({2    fieldId: /* string */,3    formula: /* string */,4    type:    /* string */,5    alias:   /* string, optional */,6    groupBy: /* boolean, optional */,7    label:   /* string, optional */,8    context: /* Object, optional */9});
Oracle reference for this method
ParameterTypeRequiredDescription
options.fieldIdstringThe field ID of the query result column. This value sets the Column.fieldId property. Obtain this value from the Records Catalog. The Records Catalog lists every record type and field that is available using SuiteAnalytics Workbook and the N/query module. For more information, see Records Catalog Overview .
options.formulastringThe formula used to create the query result column. This value sets the Column.formula property. For more information about formulas, see Formulas in Searches and SQL Expressions .
options.typestringIf you use the options.formula parameter, use this parameter to explicitly define the formula's return type. This value sets the Column.type property. Use the appropriate query.ReturnType enum value to pass in your argument. This enum holds all the supported values for this parameter.
options.aliasstringoptionalThe alias for the column. An alias is an alternate name for a column, and the alias is used in mapped results. This value sets the Column.alias property. You must specify an alias in certain situations if you want to use ResultSet.asMappedResults() or Result.asMap() . For more information, see Column.alias .
options.groupBybooleanoptionalIndicates whether the query results are grouped by this query result column. This value sets the Column.groupBy property. If you do not pass in an argument, the default value is set to false .
options.labelstringoptionalThe label for the column. A label is important if the query object is used as the data source for printing (for example, in the TemplateRenderer.addQuery(options) method in the N/render module).
options.contextObjectoptionalThe field context for values in the query result column. This value sets the Column.context property. If you do not pass in an argument, the default value is set to query.FieldContext.RAW .
B

No syntax of its own.

The compiler already calls Query.createColumn(options) inside query T, so programs use it without naming it. Writing it directly has no syntax yet.

C

Competing syntax for createColumn, from GitHub Discussions. Select two or more to compare them side by side.

All discussions

Loading proposals from GitHub…

D

Write the Mynt you wish you could write.

A good proposal shows the syntax, the SuiteScript it should become, and argues for it: why it is clearer, how it fits the rest of the language, what it makes harder.

  • Clarity. Does it say what happens, without ceremony?
  • Consistency. Does it read like load, save and Ref[field]?
  • Expressiveness. Does it cover the cases people actually write?
  • Honesty. Does it hide a NetSuite cost, such as governance, that a reader should see?

N/query · Query.createColumn(options)

Suggest syntax for createColumn