QBAggregates

Properties Summarized

TypeNameSummary

Get query builder parent table clause, this may be a query or a join clause.

Get query builder parent.

Methods Summarized

TypeNameSummary

Create avg(value) expression

Create count(*) expression

Create count(value) expression

Create max(value) expression

Create min(value) expression

Create sum(value) expression

Properties Detailed

parent

Get query builder parent table clause, this may be a query or a join clause.

Type QBSelect

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)

root

Get query builder parent.

Type QBSelect

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)

Methods Detailed

avg(Object)

Create avg(value) expression

Parameters

Returns: QBColumn

Sample

var query = datasources.db.example_data.orders.createSelect();
	query.result.add(query.aggregates.avg(query.columns.amount)).add(query.columns.countryCode)
	query.groupBy.add(query.columns.countryCode)
 var ds = databaseManager.getDataSetByQuery(query, 100);

count()

Create count(*) expression

Returns: QBColumn

Sample

var query = datasources.db.example_data.orders.createSelect();
	query.result.add(query.aggregates.count().add(query.columns.countryCode)
	query.groupBy.add(query.columns.countryCode)
 var ds = databaseManager.getDataSetByQuery(query, 100);

count(Object)

Create count(value) expression

Parameters

Returns: QBColumn

Sample

var query = datasources.db.example_data.orders.createSelect();
	query.result.add(query.aggregates.count(query.columns.amount)).add(query.columns.countryCode)
	query.groupBy.add(query.columns.countryCode)
 var ds = databaseManager.getDataSetByQuery(query, 100);

max(Object)

Create max(value) expression

Parameters

Returns: QBColumn

Sample

var query = datasources.db.example_data.orders.createSelect();
	query.result.add(query.aggregates.max(query.columns.amount)).add(query.columns.countryCode)
	query.groupBy.add(query.columns.countryCode)
 var ds = databaseManager.getDataSetByQuery(query, 100);

min(Object)

Create min(value) expression

Parameters

Returns: QBColumn

Sample

var query = datasources.db.example_data.orders.createSelect();
	query.result.add(query.aggregates.min(query.columns.amount)).add(query.columns.countryCode)
	query.groupBy.add(query.columns.countryCode)
 var ds = databaseManager.getDataSetByQuery(query, 100);

sum(Object)

Create sum(value) expression

Parameters

Returns: QBColumn

Sample

var query = datasources.db.example_data.orders.createSelect();
	query.result.add(query.aggregates.sum(query.columns.amount)).add(query.columns.countryCode)
	query.groupBy.add(query.columns.countryCode)
 var ds = databaseManager.getDataSetByQuery(query, 100);

Last updated