Create SQL Actions with AI Assistant in UI Design mode

Use AI (artificial intelligence) Assistant in SQL Editor in Kuika.

To enhance the functionalities of your application, you can create custom actions. You can create custom actions using the Custom Actions panel in the UI Design mode and/or the Actions section in the Datasources view mode.

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

Open the Custom Actions panel and click on the Add SQL Action button.

The SQL Editor will open on the next screen.

After clicking on the Add SQL Action button, the SQL Editor will be opened on the next screen.

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

1. Action naming area

You can add or update the action name using the SQL Actions name field. When naming, you can use alphabet characters in the English language and also "-" or "_" characters.

2. Use the SQL Editor Modal in full-screen mode.

In the UI Design view, you can expand the SQL Editor modal to full-screen or use it in the standard size.

3. Use the SQL Editor to write queries.

You can create the SQL query for the custom action you want to build by entering it into the SQL editor.

Kuika allows you to quickly add Select, Save, and Delete queries, which you might need during the custom action creation process.

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

3.1. Add Select Query:

Select is used to choose records in database tables and return data that meet specific query criteria. For example, a query like SELECT * FROM table_name is created.

3.2. Add Select By Id Query

It is used to select a specific record in the database table using a unique identifier (ID). For example, it creates an SQL query like SELECT * FROM table_name WHERE id = specific_id.

3.3. Add Save Query

To add a new record to the database and/or update an existing one, the Save action is used. The Save action first queries whether the record exists in the table using the Update command. If the record exists, it updates the entry with the new incoming data. If the record does not exist, the Insert Into command is activated and creates a new record in the data table.

3.4. Add Delete Query:

To delete a record in the database, the DELETE operation is used. For example, DELETE FROM table_name WHERE condition statement

3.5. Add Search By Keyword Query:

It is used to search records in a database table based on a specific keyword. It retrieves records that match the keyword. For example, SELECT * FROM table_name WHERE column_name LIKE '%keyword%'

3.6. Add Search with pagination Query:

It is used to search records in a database table according to a keyword and to paginate the results. Pagination is done using LIMIT and OFFSET. For example, SELECT * FROM table_name WHERE column_name LIKE '%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 with the help of the AI assistant. Open the chat area with Generate with AI option at the top. Select the data table that the action will use through the Selectbox. Then define the query you want to create using the table and enter it as a Prompt. For example, enter the prompt for an SQL query that deletes items.

An SQL query suitable for the prompt will be prepared with the help of artificial intelligence. You can copy and paste the query from the SQL editor to use it.

5. Adding the queries to the SQL Editor

You can quickly add the queries generated and copied with the AI assistant to the SQL Editor using the button indicated in the above image.

6. Query result parameter panel

Through the parameter panel, you can view the parameters in your custom action that you have manually written SQL queries for or prepared with the AI assistant. You can show or hide the panel using the open/close button in the top right corner. This panel is dynamically updated based on the parameters of the action you have created.

7. Testing SQL queries

You can test the query you have added with the SQL editor using the TEST button.

After completing all the steps, you can click on the CREATE button to complete the process of creating a custom action.

Last updated