query.Component
Object Description |
One component of the query definition. Each new component is created as a child to the previous component. All components exist as children to the query definition (query.Query). You can think of a component as a building block; each new component builds on the previous component created. The last component created encapsulates the relationship between it and all of its parent components. The query definition always contains at least one component. Queries with joins contain multiple components. The query definition (query.Query) contains a child
|
Supported Script Types |
Client and server scripts For more information, see SuiteScript 2.x Script Types. |
Module |
|
Methods and Properties |
|
Since |
2018.1 |
Syntax
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