Queries are stored in view variables, just like any other variable. A query is defined as an object variable, with the
Listing All Objects
To query all members, use
Listing All Objects in a Relationship
To query all members in a household, do a lookup through the household (remember that we defined the name of the relationship as "members"):
Note that the result of a query is a Query object, not a regular array. The query is automatically re-evaluated when the view is reloaded.
To determine the number of results returned by a query, use its
Queries may be filtered, using the
To find a single object, use
Note that if multiple objects match the query with get, an arbitrary one is returned.
Filtering may be performed on multiple attributes by combining them with
or, for example:
On numbers, any of the
= != > < >= <= operators may be used. Complex conditions may also be constructed with
String matching is possible - always case insensitive:
Relationships may also be filtered further:
Queries may be chained - internally this combines the individual parts with
Queries may be sorted by one or more attributes:
limit()is undefined, please ensure that you've upgraded to version 3.7.5 or later if you are using Android.
You can limit the maximum number of results returned by a query using the
limit() function as shown below:
All objects in a query can be deleted from the database with
Looping Through Objects
If an object is modified in a loop, it must be saved manually: