Creating Database Queries
After you created your Database Connection, now it's time to setup a Database Query. The first thing we need to do is to create a new API Action (also known as Server Action). The API Actions are loca
Creating an API Action
Section titled “Creating an API Action”Right click API and select Add API Action:
Section titled “Right click API and select Add API Action:”Give it a name, we call our API Action - records:
Section titled “Give it a name, we call our API Action - records:”Step 5
Section titled “Step 5”You can see the API Action, loaded in a separate tab. There you will find its steps and that’s where we define all the server side logic that we need.
Creating a Database Query
Section titled “Creating a Database Query”Right click steps:
Open Database Actions and select Database Query:
Section titled “Open Database Actions and select Database Query:”Basic Options
Section titled “Basic Options”Your existing database connection will be automatically selected in the dropdown. If you have more than one database connections defined, make sure select the one you need:
Click the Query Builder button:
Section titled “Click the Query Builder button:”Selecting Tables and Columns
Section titled “Selecting Tables and Columns”Open the database tables drop-down and select a table:
Step 13
Section titled “Step 13”Step 14
Section titled “Step 14”If you want to add all the table columns to the query, you don’t have to do anything else - the table is already added. If you want to add specific columns to the query, just select them (using Ctrl + click / Cmd + click) and click the add button:
Query Conditions
Section titled “Query Conditions”You can add conditions/filters to your database query. Click the Conditions tab:
Here you can setup your query conditions, just select a column:
Section titled “Here you can setup your query conditions, just select a column:”Then select a condition:
Section titled “Then select a condition:”Step 19
Section titled “Step 19”And add a value for the condition. This can be a dynamic value, or a static one. In our example we add a static value:
You can add multiple conditions or groups of conditions to your queries. Click the Add New Condition buton:
Section titled “You can add multiple conditions or groups of conditions to your queries. Click the Add New Condition buton:”Step 21
Section titled “Step 21”Just select how to combine these conditions - using the AND or OR operators. Clicking the operator toggles it from AND to OR.
Selecting AND will only return records which match both conditions, while using OR will return any records matching any of the conditions.
We set the operator to AND:
And then we setup our second condition:
Section titled “And then we setup our second condition:”Sorting Query Results
Section titled “Sorting Query Results”You can add sorting options to your query, select the Sorting tab:
Select the column you want to sort the query by and add it to the sort list:
Section titled “Select the column you want to sort the query by and add it to the sort list:”Then just select the sort order:
Section titled “Then just select the sort order:”You can see the generated code for the database query, which you just set up:
Section titled “You can see the generated code for the database query, which you just set up:”Click OK in order to apply the query options:
Section titled “Click OK in order to apply the query options:”Previewing the Results
Section titled “Previewing the Results”Make sure the Output option is enabled. When disabled, the query results won’t be displayed on the freont-end:
Do not forget to save your server action by using the Ctrl + S / Cmd + S shortcut:
Section titled “Do not forget to save your server action by using the Ctrl + S / Cmd + S shortcut:”Step 32
Section titled “Step 32”You can preview your query results by selecting the server action and then clicking the Open in Browser button:

























