Create Custom Actions with SQL Editor in Datasources Module
In Kuika, you can create custom actions and integrate them into your screens. In the Datasources module, you can view and manage existing data sources, actions, and tables.
Steps:
Log in to the Kuika platform and open your project from the Apps screen.
Open the Datasources module from the top menu.
In the Sources section of the left panel, expand the Managed DB heading.
Click the + icon next to the Actions row.
Select the New SQL Action option from the dropdown menu.
Type the action’s name in the name field at the top of the editor and click the checkmark (✓) icon next to it.
The action is created based on the data source under which it is created. Actions created under Managed DB use Kuika’s managed database.
You can create a folder using the New Folder option in the same menu and organize your custom actions within that folder. The New Select Action option allows you to create a selection-based action without writing SQL.
Example Scenario: Department List Action
Purpose: To create an action in the application that lists the departments included in the employee list.
Create a table named Department.
Add the custom action named Select Department List.
In the SQL Editor, write the following query:
SELECT*FROM Department
WHERE DepartmentName LIKE@searchForOR@searchForISNULLOR@searchFor=''ORDERBY DepartmentName;
View the parameters used by the query in the Parameters tab on the right panel and enter test values if necessary.
Click the Run button in the upper-right corner to test the query. You can view the results in the Result tab at the bottom of the editor, and any errors or warnings in the Messages tab.
Click the CREATE button to create the custom action.
The created action is listed under the Actions heading in the left panel. You can open, view, edit, or delete the action from here.
Custom actions used in any module cannot be deleted unless they are first removed from the module they are associated with. In this case, the system may display an error message.
Viewing Usage Locations
You can view on which pages and elements an SQL Action is used. This allows you to see, before making any changes, which parts of the application will be affected by changes made to the action.
Copying the Query with Parameters
In the action’s right-click menu, under the Edit SQL Action option, you’ll find the Copy query with parameters option. This option copies the query inside the action to the clipboard—with the parameter values entered on the screen already substituted—without requiring you to open the action. The copied query can be pasted directly into an SQL IDE and executed.
Automatically inserted values: Parameters entered as “Fixed Value” and fixed default values (null, Empty, Space, True, False, Now, New Guid, Empty Guid). Values are formatted according to their type: string values are enclosed in single quotes, numeric values are written as plain numbers, and boolean values are written as 1/0 or true/false depending on the data source type.
Non-auto-filled values: Parameters dependent on an element, Screen Input, Bag, or the result of another action are left exactly as they are in the format @parameterName / :parameterName. Since these values are determined only at runtime, they are unknown during the design phase; to avoid confusion, these fields must be filled in manually in the IDE.
The notification that appears after the copy operation shows how many parameters were automatically filled in (e.g., 3 of 8 parameter values filled in.). This allows you to immediately see how many fields need to be filled in manually.