Get/set the distinct flag for the query. |
|
Get query builder parent table clause, this may be a query or a join clause. |
|
Get query builder parent. |
|
|
Add an aggregate to the query result. |
|
Add an aggregate with alias to the query result. |
|
Add a column to the query result. |
|
Add a column with alias to the query result. |
|
Add a function result to the query result. |
|
Add a function with alias result to the query result. |
|
Add a case searched expression to the query result. |
|
Add a case searched expression with alias to the query result. |
|
Add the tables' primary pk columns in alphabetical order to the query result. |
|
Add a query to the query result. |
|
Add a query with alias to the query result. |
|
Add a custom subquery to the query result. |
|
Add a custom subquery with alias to the query result. |
|
Add a value to the query result. |
|
Add a value with an alias to the query result. |
|
Clear the columns in the query result. |
|
returns an array with all the columns that will be in the select of this query. |
|
|
Get/set the distinct flag for the query. |
|
|
Supported Clients SmartClient,WebClient,NGClient |
|
|
Sample query.result.distinct = true |
|
|
|
|
Get query builder parent table clause, this may be a query or a join clause. |
|
|
Supported Clients SmartClient,WebClient,NGClient |
|
|
Sample var query = datasources.db.example_data.person.createSelect();
query.where.add(query.joins.person_to_parent.joins.person_to_parent.columns.name.eq('john'))
foundset.loadRecords(query) |
|
|
|
|
Get query builder parent. |
|
|
Supported Clients SmartClient,WebClient,NGClient |
|
|
Sample var subquery = datasources.db.example_data.order_details.createSelect();
var query = datasources.db.example_data.orders.createSelect();
query.where.add(query
.or
.add(query.columns.order_id.not.isin([1, 2, 3]))
.add(query.exists(
subquery.where.add(subquery.columns.orderid.eq(query.columns.order_id)).root
))
)
foundset.loadRecords(query) |
|
|
|
|
|
Add an aggregate to the query result. |
|
|
Parameters the aggregate to add to result |
|
|
|
|
Supported Clients SmartClient,WebClient,NGClient |
|
|
Sample query.result.add(query.columns.label_text.max) |
|
|
|
|
Add an aggregate with alias to the query result. |
|
|
Parameters the aggregate to add to result |
|
|
|
|
Supported Clients SmartClient,WebClient,NGClient |
|
|
Sample query.result.add(query.columns.item_count.max, 'maximum_items') |
|
|
|
|
Add a column to the query result. |
|
|
Supported Clients SmartClient,WebClient,NGClient |
|
|
Sample query.result.add(query.columns.custname) |
|
|
|
|
Add a column with alias to the query result. |
|
|
Supported Clients SmartClient,WebClient,NGClient |
|
|
Sample query.result.add(query.columns.custname, 'customer_name') |
|
|
|
|
Add a function result to the query result. |
|
|
Parameters the function to add to the result |
|
|
|
|
Supported Clients SmartClient,WebClient,NGClient |
|
|
Sample query.result.add(query.columns.custname.upper()) |
|
|
|
|
Add a function with alias result to the query result. |
|
|
Parameters the function to add to the result |
|
|
|
|
Supported Clients SmartClient,WebClient,NGClient |
|
|
Sample query.result.add(query.columns.custname.upper(), 'customer_name') |
|
|
|
|
Add a case searched expression to the query result. |
|
|
Parameters The searched case expression. |
|
|
|
|
Supported Clients SmartClient,WebClient,NGClient |
|
|
Sample var query = datasources.db.example_data.order_details.createSelect();
// case expressions can be added to the result of the query
query.result.add(query.case.when(query.columns.quantity.ge(1000)).then('BIG').else('small'));
// they can also be used in conditions
query.where.add(query.case
.when(query.columns.discount.gt(10)).then(50)
.when(query.columns.quantity.le(20)).then(70)
.else(100)
.multiply(query.columns.unitprice).lt(10000)); |
|
|
|
|
Add a case searched expression with alias to the query result. |
|
|
Parameters The searched case expression. |
|
|
|
|
Supported Clients SmartClient,WebClient,NGClient |
|
|
Sample var query = datasources.db.example_data.order_details.createSelect();
// case expressions can be added to the result of the query
query.result.add(query.case.when(query.columns.quantity.ge(1000)).then('BIG').else('small'));
// they can also be used in conditions
query.where.add(query.case
.when(query.columns.discount.gt(10)).then(50)
.when(query.columns.quantity.le(20)).then(70)
.else(100)
.multiply(query.columns.unitprice).lt(10000)); |
|
|
|
|
Add the tables' primary pk columns in alphabetical order to the query result. |
|
|
Supported Clients SmartClient,WebClient,NGClient |
|
|
|
Add a query to the query result. |
|
|
Supported Clients SmartClient,WebClient,NGClient |
|
|
Sample // make sure the query returns exactly 1 value.
query.result.addSubSelect(subquery); |
|
|
|
|
addSubSelect(query, alias) |
|
Add a query with alias to the query result. |
|
|
Supported Clients SmartClient,WebClient,NGClient |
|
|
Sample // make sure the query returns exactly 1 value.
query.result.addSubSelect(subquery, "mx"); |
|
|
|
|
addSubSelect(customQuery, args) |
|
Add a custom subquery to the query result. |
|
|
Supported Clients SmartClient,WebClient,NGClient |
|
|
Sample // make sure the subquery returns exactly 1 value.
// select (select max from othertab where val = 'test') from tab
query.result.addSubSelect("select max(field) from othertab where val = ?", ["test"]); |
|
|
|
|
addSubSelect(customQuery, args, alias) |
|
Add a custom subquery with alias to the query result. |
|
|
Supported Clients SmartClient,WebClient,NGClient |
|
|
Sample // make sure the subquery returns exactly 1 value.
// select (select max from othertab where val = 'test') as mx from tab
query.result.addSubSelect("select max from othertab where val = ?", ["test"], "mx"); |
|
|
|
|
Add a value to the query result. |
|
|
Supported Clients SmartClient,WebClient,NGClient |
|
|
Sample query.result.addValue(100) |
|
|
|
|
Add a value with an alias to the query result. |
|
|
Supported Clients SmartClient,WebClient,NGClient |
|
|
Sample query.result.addValue(100, 'myvalue') |
|
|
|
|
Clear the columns in the query result. |
|
|
Supported Clients SmartClient,WebClient,NGClient |
|
|
|
returns an array with all the columns that will be in the select of this query.
can return empty array. Then the system will auto append the pk when this query is used. |
|
|
Returns Array An array of QBColumn thats in the select of this query. |
|
|
Supported Clients SmartClient,WebClient,NGClient |
|
|
Sample var columns = query.result.getColumns(); |
|
|
|
|
|
|