Create SQL Actions with AI Assistant in UI Design mode

You can create custom actions to increase the functionality of your application. You can use Custom Actions panel in UI Design view mode and/or Actions section in Datasources view mode to create custom actions.

Let's examine how to create a custom action with the Custom Actions panel in UI Design view mode.

Open the Custom Actions panel and click the Add SQL Action button, the SQL Editor below will open on the next screen.

Let's take a closer look at the fields shown with numbers in the image above and examine the process of creating a custom action.

1. Action naming field

You can add and update the action name with SQL Actions name field. You can use English language alphabet characters and also ‘-’ or ‘_’ characters in naming.

2. Use the SQL Editor Modal in full screen.

You can expand the SQL editor, which opens modally in the UI Design view, as full screen or use it in its standard size.

3. Write queries using SQL Editor

You can create an action by entering the SQL query of the special action you want to create in the SQL editor field.

Kuika allows you to quickly add Select, Save and Delete queries that you will need during the action creation process.

For this process, hover over the tables on the left side with the cursor. By clicking on the three dots to the right of the table names, you can create and quickly add Select, Select By Id, Save, Delete, Search By Keyword and Search With Pagination queries for the selected table with one click.

3.1. Add Select Query:

Select is used to select records in database tables and return data that matches certain query criteria. For example,

“SELECT* FROM table_name”such query is created.

3.2. Add Select By Id Query

Used to select a specific record using a unique ID from a database table. For example,

SELECT * FROM table_name WHERE id = certain_id;creates a SQL query such as.

3.3. Add Save Query

Add Save Query action is used to add a new record to the database and/or update an existing record. The Save action first queries whether there is a record in the table with the Update command and if there is a record, it updates the record with the new data. If there is no record, the Insert Into command is activated and creates a new record in the data table.

3.4. Add Delete Query:

DELETE operation is used to delete a record in the database. For example

DELETE FROM table_name WHERE condition expression”

3.5. Add Search By Keyword Query:

It is used to search for records in the database table according to a specific keyword. It returns records matching the keyword. For example,

SELECT * FROM table_name WHERE column_name LIKE ‘%key_keyword%’;

3.6. Add Search with pagination Query:

It is used to search for records in a database table by keyword and split the results into pages. Paging is done using LIMIT and OFFSET. For example,

SELECT * FROM table_name WHERE column_name LIKE ‘%key_keyword%’ LIMIT page_size OFFSET start;

4. Use the AI assistant for your SQL queries

While writing your SQL queries, you can quickly prepare actions by getting support from the artificial intelligence assistant. Open the chat area with Generate with AI from the top section. Select the data table that the query will use for the action via Selectbox. Then define the query you want to create using the table and enter it as Prompt. For example; Enter the prompt I need a query that allows items to be deleted.

A suitable query is prepared with artificial intelligence. You can use it by adding the query with copy/paste into SQL editor.

5. Adding queries to SQL Editor

You can quickly add the queries created and copied with the artificial intelligence assistant to the SQL Editor via the button in the image above.

6. Query result parameter panel

Through the parameter panel, you can view the parameters in your custom action for which you have manually written SQL queries or prepared queries with the AI assistant.

You can show/hide the panel with the on/off button in the upper right corner. This panel is dynamically updated according to the parameters of the action you have created.

7. Testing SQL queries

You can test the result of the query you added with the SQL editor with the TEST button.

After completing all operations, you can complete the custom action creation process by clicking the CREATE button.