When developing applications with Kuika, you can use various data sources. You can connect to databases such as MS SQL Server, PostgreSQL, and Oracle; to APIs and services such as Swagger, REST, OData, and SAP; and to MQTT brokers. You can also write your own functions using C#, TypeScript, Python, Java, Go, Rust, or Google Blockly.
Examining the Datasources Module
Log in to the Kuika platform and open the project you’ll be working on from the Apps screen.
Click the Datasources icon on the top navigation bar.
On the Datasources main screen that opens:
You can create a new data source using the Create a Database, Create an API, and Create a Function cards at the top. (See Creating a New Datasource)
The Recently modified tab lists the most recently modified data sources, while the Data sources tab lists all data sources in the project.
You can search by name using the Search by name field and filter the list by type using the dropdown menu on the right.
The list displays each data source’s name (Name), kind (Kind), type (Type), and creation information (Created). The “Name” column also shows the number of tables and actions in the data source (for example, “70 tables · 0 actions”).
By default, the list includes the Managed DB created by Kuika. With Managed DB, you can develop and deploy your application without needing an additional database server.
The Sources panel on the left lists the data sources in your application. When you expand the Managed DB, the following subheadings appear:
Actions: Actions associated with the data source. You can add a new action using the + icon next to it.
Tables: Tables in the data source are listed grouped by schemas (for example, dbo). You can add a new table using the + icon next to it.
Session Variables: Session variables. (See Session Variables)
The panel also includes the Document Parameters heading.
Creating an SQL Action
In the left panel, click the + icon next to the Actions heading.
From the dropdown menu, select New SQL Action.
The SQL editor opens. Enter a name for the action in the field at the top left and confirm by clicking the ✓ icon next to it.
Type your SQL query into the editor. The editor’s toolbar includes options for undo/redo, copy/paste, query formatting, line wrapping, and font size adjustment.
To test the query before saving it, click the Run button in the top-right corner. Results are displayed in the Result tab below the editor, while error and information messages appear in the Messages tab.
Click the CREATE button to create the action. This button is disabled when the editor is empty.
Creating an SQL Query with Kuika AI
You can create a query with the help of artificial intelligence from the Kuika AI tab on the right side of the editor:
Select one of the ready-made prompts (for example, “Write an SQL query to fetch all records from this table”) or type your own prompt in the field below.
Select the table for which the query will be created from the Choose Table field and submit.
Kuika AI displays the suggested query in the right panel. You can copy the query or add it to the editor.
You can manage the parameters used in the query from the Parameters tab in the right panel.
Editing and Deleting an Action
The created action appears under the “Actions” heading in the left panel.
To edit: Hover over the action and select the Edit option. After editing the SQL query, click the Update button.
To delete: Select the Delete option from the dropdown menu.
Creating a Select Action
Click the + icon next to the Actions heading in the left panel.
Select the New Select Action option from the dropdown menu.
In the window that opens, give the action a name.
Click the + icon to select the data source.
Configure the Fields, Filter, and Sort Order sections according to your needs.
Creating a Table
With Kuika, you can quickly add a new table to a data source.
In the left panel, click the + icon next to the Tables heading.
In the screen that opens, enter the table’s name in the top-left field and confirm with the ✓ icon.
In the Columns tab, define the table’s columns. By default, every table starts with an Id column of type Guid, marked as the primary key (PK).
4. Enter the new column information in the last row of the table. A new blank row appears below each column as it is added:
Column Name: Column name
Type: Data type
Size: Maximum length for types such as text. You can define an unlimited length using the MAX option.
Scale: Number of decimal places for decimal types
Required: Whether the field is required
Unique: Whether the value must be unique
Default: Default value
5. Click the CREATE button to create the table.
To determine the column type using an AI suggestion, use the Kuika AI (✦) button next to the Type field.
Enabling Offline Use for the Table (Work Offline)
You can enable the table to work offline on mobile devices by toggling the WORK OFFLINE switch in the top-right corner. When the switch is toggled, two options are presented:
Schema Only: The table is created in the offline database with its structure only; it does not contain any data.
With data: The table is created along with data filtered according to the criteria you specify.
When you select the With data option, the following settings appear:
Download filter: A query that determines which records will be downloaded from the server to the device.
Upload filter: A query that determines which records will be sent from the device to the server.
You can use the @kuikauserid (logged-in user’s ID) and @kuikausername (username) parameters in the filters.
Allow offline editing: When enabled, downloaded records can be updated on the device and sent to the server during the next synchronization. When disabled, records are read-only.
Editing and Deleting a Table
To edit a table: Select the table in the left panel and click the three dots. You can update the existing table using the Edit option.
To delete a table: Click the Delete option in the same menu.
Session Variables
You can define session variables by clicking the Session Variables heading in the left panel. On the screen that opens:
Key: The variable’s name
Value: The variable’s value
Read Only: Whether the variable is read-only
After making your definitions, click the SAVE button.
Creating a New Datasource and Datasource Types
There are two ways to create a new data source:
Click one of the Create a Database, Create an API, or Create a Function cards on the Datasources main screen to list the types in the relevant category.
Click the + icon next to the Sources heading in the left panel to view all types in a single menu.
Use the arrow keys to navigate through the menus and press Enter to make a selection.
Data source types are grouped into three categories: