Data Queries
Last updated
Last updated
Queries support you to read data from or write data to your data sources. You can create queries while editing an app or in the query library. This tutorial walks you through how to create a query and tailor it to your needs.
The UI of query editor varies when you choose different types of data sources. Below is an example of a connection to a DbBuilder and a corresponding statement.
Select the datasource from the list - or - create a new datasource and attach.
Appizap triggers your queries in two modes, either run automatically when inputs change or on page load, or manually invoked in event handlers.
Queries set to this mode automatically run when dependent inputs change or on page load. For example, the query result of select * from users where customer_id = {{input.value}}
updates immediately when input.value
changes. **** This mode to run a query is recommended for queries reading data from data sources.
For this mode of queries, they run only with your manual trigger, such as a button or link click. You need to specify an event handler to trigger the query. This mode is recommended for queries writing data to data sources, because you may need to confirm that the input is complete and error-free before running it.
How to choose a query's trigger mode?
In most cases, queries reading data, like select operations, can be set to the former mode, and those writing data, like create/delete/update operations, run the latter way.
When Appizap detects your query statement switches from reading to writing data, the trigger mode switches to Manually invoked automatically, but not the other way around.
The display provides a comprehensive view of all the tables accessible within the DbBuilder source. Users have the option to select a specific table from the displayed list of tables.
Create row
To insert a new record into the table picked. User needs to enter the values for each column of the table.
Update row
To update an existing row of the table. The user needs to provide the id value and values for the other columns of the table.
Delete row
To delete one or more rows from the selected table, the user can set the criteria using the input fields shown below this field and the records matching the criteria get deleted.
List
To retrieve the existing records from the table, the user can set the criteria using the input fields shown below this field and the records matching the requirements get pulled. The "Limit" field permits the user to input a numerical value, and the query will fetch that specific number of records.
Appizap evaluates your query statement with JavaScript code inside {{ }}
in real-time, and the result is displayed below in a floating box, so you can use it to check the correctness of the query statement.
The user can activate an action following the execution of the query event. There are two possible outcomes: 'success' and 'failure', with the action being triggered accordingly.
In notification and advanced tabs, you can configure settings regarding notifications, timeout, periodic run, and more. Settings in Notification tab and Advanced vary based on trigger mode of your query.
Notification
Display a Success message after running
🚫
✅
Display a Failure message after running
✅
✅
Advanced
Display a confirmation modal before running
🚫
✅
Set timeout for query running
✅
✅
Perform query periodically
✅
🚫
Refer to Temporary State for more details.
Refer to Transformer for more details.
Refer to Data Responder for more details.
Allows the users to engage in writing and manipulating javascript code, providing a platform for the creation and modification of scripts that can be executed.
Refer to Write JavaScript for more details.
When the user calls and executes this query, the logout action is triggered.
If a new execution is triggered, the result of the previous uncompleted executions will be ignored if the previous executions did not complete, and the ignored executions will not trigger the event list of the query.
Pick the required query from the library, that is created using Query Library interface. It can be viewed in a separate window for quick reference. It allows the user to choose the version of the query from its history.
The user can activate an action following the execution of the query event. There are two possible outcomes: 'success' and 'failure', with the action being triggered accordingly.
A new directory is generated within the Data Queries segment. The folder will contain all relevant files for ease of access. The newly created folder is meant to store various files and documents within the Data Queries area for convenient retrieval.
Refer to Data Sources for more information.