User Guide: Managing Queries with Kotlin

Welcome to the Onyx Cloud Database User Guide for managing queries using Kotlin. This guide will walk you through creating, executing, viewing results, sharing, applying query categories, and updating your queries effectively.

Creating a Query

Creating a new query allows you to interact with your database using Kotlin scripts. Follow these steps to create a new query.

1

Navigate to the Queries Page

From your dashboard, select the Queries Page to manage your database queries.

Queries Page
2

Click on 'Create New Query'

On the Queries Page, click the Create New Query button to open the query creation modal.

3

Fill in Query Details

Provide the necessary details for your query:

  • Query Name: Assign a meaningful name to your query.
  • Category: Select or create a category to organize your query.
  • Public: Toggle this option if you want to share the query with your team.
Create Query Modal
4

Write Your Kotlin Query

In the query editor, write your Kotlin script to interact with the database. Utilize the Query Scripting Tutorial for detailed instructions.

5

Save Your Query

After writing your query, click the Save button to store it in your queries list.

Executing a Query

Running your Kotlin query allows you to fetch and manipulate data within your database. Follow these steps to execute your query.

1

Select Your Query

From the Queries Page, select the query you wish to execute by clicking on its name.

Select Query
2

Click on 'Execute Query'

With your query selected, click the Execute Query button located in the top menu to run the script.

3

Monitor Execution Status

A spinner will appear indicating that your query is being processed. You can cancel the execution at any time by clicking the Cancel button.

Viewing Results

After executing a query, you can view the results in various formats. This section explains how to navigate through the different result panels.

1

Access the Results Panel

Once the query execution is complete, the results panel will appear at the bottom of the screen.

2

Switch Between Result Panels

The results can be viewed in three different panels:

  • Grid Results: Displays data in a tabular format.
  • Tree Results: Shows data in a hierarchical tree structure.
  • Console: Displays logs and compile errors.

Click on the respective tabs to switch between these panels.

3

Interacting with Grid Results

The Grid Results panel provides a spreadsheet-like view of your data. You can sort, filter, and paginate through the records.

Grid Results
4

Exploring Tree Results

The Tree Results panel presents your data in a nested tree structure, allowing for easy navigation through hierarchical relationships.

Tree Results
5

Reviewing Console Logs

The Console panel displays logs, compile errors, and other diagnostic information. This is useful for debugging and monitoring query execution.

Console Log

Sharing a Query

Sharing your queries with team members promotes collaboration and efficiency. Follow these steps to share a query.

1

Select the Query to Share

Navigate to the Queries Page and select the query you wish to share by clicking on its name.

2

Toggle the 'Public' Option

In the query details, toggle the Public switch to make the query accessible to your team members.

Public Toggle

Applying Query Categories

Organizing your queries into categories helps maintain structure and improves accessibility. Here's how to apply categories to your queries.

1

Access the Query Creation Modal

From the Queries Page, click on Create New Query to open the query creation modal.

Create Query Modal
2

Select or Create a Category

In the Category field, select an existing category from the dropdown or type a new category name to create one on the fly.

3

Assign the Category to Your Query

After selecting or creating a category, assign it to your query by ensuring the category name is correctly filled in the Category field.

Updating a Query

Keeping your queries up-to-date ensures they remain effective and relevant. Follow these steps to update an existing query.

1

Select the Query to Update

Navigate to the Queries Page and click on the query you wish to update.

2

Open the Query Editor

Click on the Edit button to open the query editor.

3

Modify the Kotlin Script

Make the necessary changes to your Kotlin script in the editor. Ensure that your modifications adhere to Kotlin syntax and the database schema.

4

Save the Updated Query

After making your changes, the query will automatically be saved.

5

Execute the Updated Query

With the query updated, click the Execute Query button to run the revised script and view the new results.

Next Steps

Need Help?

If you have any questions or need assistance: