Query

An universal chainable data query interface object.

Included in: dx.phonejs.js, dx.webappjs.js, dx.chartjs.js, dx.all.js
Type:

Object

To create a Query, call the query(array) or query(url, queryOptions) utility function, depending on the type of storage you access. The Query enables you to execute several methods in a single statement, as it supports method chaining.

JavaScript
var processedArray = DevExpress.data.query(inputArray)
    .filter([ [ "value", ">=", 10 ], "and", [ "value", "<=", 90 ]])
    .sortBy("lastName")
    .thenBy("firstName")
    .select("lastName", "firstName", "value")
    .toArray();

For more information on the Query concept, refer to the Data Layer article.

Methods

This section describes the methods used to access the data associated with the Query.

Name Description
aggregate(seed, step, finalize)

Calculates a custom summary for the items in the current Query.

aggregate(step)

Calculates a custom summary for the items in the current Query.

avg()

Calculates the average item value for the current Query, if each Query item has a numeric type.

avg(getter)

Calculates the average item value for the current Query.

count()

Returns the total count of items in the current Query.

enumerate()

Executes the Query.

filter(criteria)

Filters the current Query data.

filter(predicate)

Filters the current Query data.

groupBy(getter)

Groups the current Query data.

max()

Finds the item with the maximum value in the Query.

max(getter)

Finds the item with the maximum getter value.

min()

Finds the item with the minimum value in the Query.

min(getter)

Finds the item with the minimum getter value.

select(getter)

Applies the specified transformation to each item.

slice(skip, take)

Limits the data item count.

sortBy(getter)

Sorts current Query data.

sortBy(getter, desc)

Sorts current Query data.

sum()

Calculates the sum of item values in the current Query.

sum(getter)

Calculates the sum of item getter values in the current Query.

thenBy(getter)

Adds one more sorting condition to the current Query.

thenBy(getter, desc)

Adds one more sorting condition to the current Query.

toArray()

Returns the array of current Query items.