Output Tab

The Output tab of the Query All Records function

The Output tab controls how the data is returned from the Query All Records function.

Response:

Customize Customize the fields included in the response of the function. By default all fields shown will be included. However, choose the customize response button to pick and choose which fields you'd like included. This is useful when you don't need all the fields but only a select few.

Addon Addons are a unique and powerful feature of Xano that are similar to Graph QL. They allow you to decorate the data of your primary table with data from other database tables. Addons are covered in detail later in this section.

Return:

Type Return type allows you to specify how you want to return the data from the query.

  • List - This is by default. List returns a list of records matching any filters you may or may not include in your function. A list signifies an array, so keep this in mind if you need to do additional manipulation the returned data. You typically need to iterate (Loop) over an array/list to manipulate it.

  • Exists - This returns a true or false there is an existence of records matching any filters included or not.

  • Count - Count will return a count of the matching records.

  • Single - Returns a single record. Get Record can be used as a shortcut for this. However, this return type is useful if you need to look something up based on multiple fields, use a join, sort, or any additional customization available on the Query All Records function.

  • Aggregate - Allows you to aggregate the data from the Query All Records function. You have access to Group By, Aggregated By, Aggregator (how the data is being aggregated), and Sorted By.

  • Stream - Stream is a special return type used for For Each Loops. Stream retrieves database records in a memory-friendly way so that the For Each Loop can iterate through all of the records without the need for paging.

Stream is only for use with For Each Loops. Returning a Query All Records function with a Stream return type will not produce any records in the result.

Stream utilizes paging behind the scenes so it should not be used for deleting records because results change as records are deleted.

If you are using Stream with a custom query, it is important to not modify the data in the fields you are using in the custom query. With the behind-the-scenes paging that Stream utilizes, this can cause a discrepancy between the records returned and the records updated. This will appear as if records to update are being "skipped".

Sorting Sorting allows you to sort the results of the function in ascending, descending, or random order.

Paging / Pagination Enable paging to page the results, especially of large datasets where you don't need to query all the included records. You can also take advantage of paging to limit the results of a query. When paging is enabled you can select how many records per page, which page number, and optionally include page metadata and total item count.

Distinct Distinct records can be manipulated based on the requirements for your query. By default automatic detection is enabled - meaning it will automatically detect whether you want distinct records or not based on your query's settings. However, you can choose to override this and either enable or disable distinct records.

Evals

Evals are completely optional. They allow you to reference fields in joined tables to add them to your query response.

Lock

Database lock is an optional setting used to lock the query from executing while other APIs are updating the same table. This feature can be useful when there is a high volume of simultaneous API requests affecting the same database records.

An example of this could be an incremental counter. If the same API is being hit simultaneously it's possible the same count number gets added more than once. With lock enabled on a get action, the get would be locked until other APIs complete updating, adding, or deleting in the same table. Once those operations have ended, the get can retrieve the records.

Last updated