Queries
Queries from JavaScript can be written in a SQL-Like syntax.
Simple Query
Queries can be constructed using the Query class. Calling the toReadRequest method returns a ReadRequest, which can be passed to the authRequest.read method to retrieve the result set.
src / pages / index.tsx
By default the top 5 records are returned. See the Top section below to change this.
Fields
Select the fields to return by providing a string array to the Query constructor.
Query
Select all fields by providing a *.
Query
Filtering
Results can be filtered using the where method on the Query class.
Query
When filtering on a DateTime field, the value must be in ISO 8601 format. ie:
2025-10-01 or 2025-10-01T00:00:00Z (YYYY-MM-DD or YYYY-MM-DDTHH:MM:SSZ)
Additional criteria can be provided using the and and or methods.
Query
Filter Operators
The following are valid filter operators. Contains applies to string fields only.
== != > < >= <= Contains
Inner Join
Inner joins can be performed by using the join method.
Query
The parameters for a join are -
- From table and field
 - To table and field
 - Alias
 - Fields to include (Can be '*' for all fields)
 
Left Join
Left joins can be performed using the leftjoin method.
Query
Filter on Join Fields
Queries can be filtered on their joined tables by referencing their alias in the filters.
Query
Cascading Join
When joining multiple tables, you can reference previously joined tables using their aliases to establish further joins.
Query
Top
The number of results returned can be limited by using the top method. In the example below, the first 100 results are returned.
Query
Paging
Paging can be performed by using the page method. The below example will return records 21 to 30.
Query
Order
The order of records can be set using the orderBy method.
Query
Parameters for orderBy are -
- Name of field
 - Order ("asc", "desc")
 
There can be multiple orders. In the example below, first the Widgets are ordered by Price, then by Name.
Query
Ordering can also be performed on joined tables.
Query
Denormalize
Denormalize is useful when joined tables need to return their data in arrays. Denormalization can be enabled by using the denormalize method.
For example, a query without denormalization like the query below will return the following json.
Query
Response - Without Denormalization
When denormalization is enabled as seen in the query below, the following json is returned.
Query
Response - With Denormalization
Key Difference: Contacts are now grouped into arrays named after the alias (c), resulting in one row per account instead of one row per contact.
Best Practices
When using queries in a React application, it is recommended to use Tanstack Query to manage the server state.