Sorting and Pagination
Sorting and pagination help you manage large sets of query results in Brinqa Query Language (BQL). You can use the ORDER BY
, SKIP
, and LIMIT
sub-clauses to organize results in a specific order, return a specific range of records, and limit the total number of records shown.
ORDER BY
Use the ORDER BY
sub-clause to sort results in ascending (ASC
) or descending (DESC
) order. Place it after the FIND
keyword.
After ORDER BY
, specify the attribute you want to sort by, followed by the sort direction. For example:
FIND Finding AS f ORDER BY f.riskRating DESC
The above query sorts the findings by the riskRating
attribute in descending order, starting with the most critical:
SKIP
Use the SKIP
keyword is followed by a number to indicate how many records to skip in the output. For example:
FIND Finding AS f SKIP 20
The above query skips the first 20 findings and returns results starting from the 21st.
You can only use SKIP
in reports, automations, and the Explorer. SKIP
is ignored in all List views.
LIMIT
Use the LIMIT
keyword to restrict the number of records returned by the query. For example:
FIND Finding AS f LIMIT 5
The above query returns only the first 5 findings from the result set.
You can only use LIMIT
in reports, automations, and the Explorer. LIMIT
is ignored in all List views.
The following query uses ORDER BY
, SKIP
, and LIMIT
together to demonstrate sorting and pagination:
FIND Finding AS f
ORDER BY f.riskRating DESC SKIP 20 LIMIT 5
The above query retrieves findings, sorts them by the riskRating
in descending order, skips the first 20 records, and then limits the result to 5 records-returning the 21st through 25th records from the sorted list.
If LIMIT
is not set in the query, it could result in a large number of records to return.