query.Column

Important:

You must include a query.Column object in your query definition to avoid scripting errors. This object is an optional parameter with the query.create(options) method, but at least one Column must be created for every query definition. For more information, see the syntax example below.

Object Description

A query result column.

The query.Column object is the equivalent of the search.Column object in the N/search Module. The query.Column object describes the field types (columns) that are displayed from the query results.

To create columns:

Supported Script Types

Client and server scripts

For more information, see SuiteScript 2.x Script Types.

Module

N/query Module

Methods and Properties

Column Object Members

Since

2018.1

Syntax

Important:

The following code sample shows the syntax for this member. It is not a functional example. For a complete script example, see N/query Module Script Samples.

            // Add additional code
...
    var myCustomerQuery = query.create({
        type: query.Type.CUSTOMER
    });
    var mySalesRepJoin = myCustomerQuery.autoJoin({
        fieldId: 'salesrep'
    });
    myCustomerQuery.columns = [
        myCustomerQuery.createColumn({
            fieldId: 'entityid'
        }),
        myCustomerQuery.createColumn({
            fieldId: 'id'
        }),
        mySalesRepJoin.createColumn({
            fieldId: 'entityid'
        }),
        mySalesRepJoin.createColumn({
            fieldId: 'email'
        }),
        mySalesRepJoin.createColumn({
            fieldId: 'hiredate'
        }),
    ];
    myCustomerQuery.sort = [
        myCustomerQuery.createSort({
            column: myCustomerQuery.columns[1]
        }),
        mySalesRepJoin.createSort({
            column: mySalesRepJoin.columns[0], ascending: false
        })
    ];
    var resultSet = myCustomerQuery.run();
...
// Add additional code 

          

Related Topics

General Notices