🔎Queries
Last updated
Last updated
If you have special handling requirements, you can add further specs for particular Event Handler Queries. Writing to and reading data from your data sources is made simpler using these queries. They can be used with a wide range of data sources, including databases, stream data sources, and conventional RESTful APIs. In the query repository or when making changes to an application, you can create queries.
All Data Queries within QuickDEV always return JSON data. Whether you're accessing a database or another data source, the result will be transformed into a JSON response. This uniformity is highly beneficial as it ensures ease of use for the data across various parts of QuickDEV without the necessity for data serialization between formats.
The query editor's appearance varies depending on the chosen data source type. For instance, consider a scenario where you're connecting to a PostgreSQL database.
The SQL Mode caters to both novices querying the database and proficient developers well-versed in SQL language and their specific database specialties.
QuickDEV additionally provides a GUI Mode for performing write operations on the database, including INSERT, UPDATE, and DELETE. This simplifies the process of binding user-generated data changes in your app back to the databases.
You have the capability to inspect the metadata of databases.
By clicking on "Metadata," you'll see the database tables and their respective fields presented in a tree structure.
Metadata proves beneficial for query writing, providing auto-suggestions as you type. Additionally, it aids in understanding the structure of the database and its tables for any connected database.
QuickDEV evaluates your query statement using JavaScript code enclosed within {{ }}
in real-time. Subsequently, the result is presented below in a floating box, enabling you to verify the accuracy of the query statement.
QuickDEV initiates your queries in two modes: it can either run automatically when "inputs change or on page load," or manually, which allows you to trigger it in other event handlers, for example.
Queries configured in this mode automatically execute when dependent inputs change or upon page load. For instance, consider a query like:
Its result will updates immediately whenever the value of input changes. This mode is recommended for queries reading data from data sources.
Be cautious when deciding to trigger a query. Data Queries that might have longer response times could potentially hinder the loading of application visuals and the display of your data.
In this mode, a query will only run when you explicitly initiate it by click a button or link. This mode is recommended for searches that send data to data sources since it might be required to confirm the accuracy and completeness of the input before running the query.
When the parsing and result processing of a Data Query is complete, you may utilize Event Handlers to start new processes. These event handlers are made up of onSuccess and onError triggers. Additionally, you can combine various Event Handlers as desired.
The onSuccess
handler is intended to execute specific actions following the successful completion of a data query. This functionality is crucial for initiating subsequent operations, such as running JavaScript queries or other queries that may require the response of an initial data query.
To use the onSuccess
handler, go to the "Event Handlers" section in the lower part of the Data Query Editor within the "General" Tab. Then, opt for "on Success," and proceed to select your desired action.
The onError
handler acts as the counterpart to the onSuccess handler, addressing instances where a data query encounters failure. This could happen due to various reasons, including network issues, API errors, or data inconsistencies.
To establish an event handling for a data query error case, just choose "Failure" from the Event Selection options for the Event Handler. Furthermore, you have the option to specify special case handling for individual Event Handlers.
You may set up notifications, timeouts, periodic runs, and other features on the notification and advanced tabs. The Notification tab and Advanced settings differ according on your query's trigger mode.
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
☑️
🚫