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
A
suitescript api
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});
| Parameter | Type | Required | Description |
|---|---|---|---|
| options.fieldId | string | The 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.formula | string | The 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.type | string | If 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.alias | string | optional | The 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.groupBy | boolean | optional | Indicates 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.label | string | optional | The 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.context | Object | optional | The 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
mynt syntax
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
community proposals
Competing syntax for createColumn, from GitHub Discussions. Select two or more to compare them side by side.
Loading proposals from GitHub…
D
suggest an alternative
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,saveandRef[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?