Query.sort

Property Description

An array of query.Sort objects used for sorting.

This object encapsulates a sort based on the query.Query or query.Component object. The query.Sort object describes a sort that is placed on a particular query result column.

To create a sort:

Type

query.Sort[]

Module

N/query Module

Parent Object

query.Query

Sibling Object Members

Query 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'
        }),
        mySalesRepJoin.createColumn({
            fieldId: 'firstname'
        }),
        mySalesRepJoin.createColumn({
            fieldId: 'email'
        })
    ];
    myCustomerQuery.sort = [
        myCustomerQuery.createSort({
            column: myCustomerQuery.columns[1]
        }),
        mySalesRepJoin.createSort({
            column: myCustomerQuery.columns[0],
            ascending: false
        })
    ];
...
// Add additional code 

          

Related Topics

General Notices