Skip to main content

Connector library

DronaHQ provides you with a comprehensive platform to consolidate information from various tables in a datasource when building applications. With the ability to create queries, you can effortlessly fetch data from different tables/documents and seamlessly present it in a cohesive manner. Beyond just fetching data, queries empower you to perform essential tasks such as inserting, updating, or removing data from a datasource. Additionally, you can easily bind this data to widgets, enabling a dynamic and interactive user experience.

Using connector library in data queries

You can navigate and click on Data queries -> + -> Connector library to add a new data query. You will see a list of added connectors in your account followed by the queries or APIs created under each connector as a library which can be used across multiple apps.

Connector library
Connector Library

You can select any of the query added in the library and you will see a model with the following sections:

  • Meta - Details of the data query including the name using which it can be referenced.
  • Environments - For ready APIs provided by DronaHQ you can configure different accounts for different environments.
  • Variables - All dynamic variables are here which can be configured with the value that you want to pass.
  • Transform response - Different options to transform the response received from the connector query.
  • Response Raw - Raw response received from the connector query.
  • Response Transformed - Response after the transformation is run on the raw data.
  • Advanced - Advanced configurations while running this data query.
Connector library
Configure from the Connector Library

Meta

You can configure the unique name of your data query here and also check the actual API call or Database query which has been configured in the connector library. There is another dropdown of Run query which has the options for the query to auto execute on change of the variables or manually trigger the execution.

Meta info
Data query meta

Environments

This section is visible only with third party ready APIs provided by DronaHQ and you can select any of the accounts added in that connector and map it to a specific environment. This will make sure that the particular account is used when the app is running in the specified environment.

Environments
Environments

Variables

All the dynamic variables used while creating a query will be listed here and you can map the actual values that should be passed along with a test value that you can use to test during the configuration stage. For e.g. you might want to configure the offset and limit of the tablegrid control and map it to the offset and limit in the SQL query you have to run pagination.

Variables
Dynamic variables
Please Note

You can refresh the raw response with the test values and check the response that is fetched to make sure your queries are running fine.

Transform response

This section allows you to transform the raw data received from the server and manipulate it to get it in the format of your choice. You can make use of the JS libraries and JS objects here as well. The output of this transformation will be seen in the transformed response section and will be the final output of the Data query for the rest of the app.

Transform response
Transform response

You can transform the response in 4 different ways:

Write Javascript

You can write your own JS script here which can utilize the JS Libraries (inbuilt and imported), JS objects and transform the raw response. In this example I am fetching limited keys from the google sheet raw response and also converting one of the comma separated values into an array.

Writing JS
Writing Javascript

The following example is of a raw response and the JS written to transform it into the required JSON output in the transformed section.

Raw Response

{
"range": "Sheet1!A2:Z10",
"majorDimension": "ROWS",
"values": [
{
"A": "John Doe",
"B": "John",
"C": "9",
"D": "XL",
"E": "Men",
"F": "Batsman,Fielder",
"G": "Non Veg",
"H": "B",
"I": "605",
"J": "9820000000",
"K": "Yes",
"L": "No",
"M": "18 - 55",
"N": "John",
"O": "2000",
"RowNumber": 2
}
]
}

JS code

function transform( data ) {
data = data.values.map(value => {
return {
name: value.A,
"diet.plan": value.G,
"type.of.player": value.F.split(",")
};
});
return data;

Transformed Response

[
{
"name": "John Doe",
"type.of.player": [
"Batsman",
"Fielder"
],
"diet_plan": "Non Veg"
},

Write DQL expressions

DQL or DronaHQ Query Language serves as an efficient query and transformation tool for JSON data, drawing inspiration from the 'location path' concepts found in XPath 3.1. This connection enables the formulation of complex queries through a condensed and user-friendly notation. The language includes a comprehensive assortment of pre-established operators and functions that facilitate the manipulation and amalgamation of the extracted information. Furthermore, the results of these queries can be molded into any desired JSON output arrangement, utilizing well-known JSON object and array constructs. Along with the capability to formulate user-specific functions, this allows for the crafting of advanced expressions designed to handle any conceivable JSON query or transformation challenge.

You can read more about it here

DQL in transformation
DQL in transform section

DQL Expression

$.Player_name

Transformed Response

[
"Raujesh Agarrwal",
"Kalpesh Jain",
"Vinod beriwal",
"Faraz",
"Abrar Kherani",
"Ruchir tiwari",
"Tanveer Madaan",
]

Filter Objects

You can define your conditions here in the following format to filter out the objects from your raw response. This will filter and get only those objects from the array which meet this defined criteria.

{{data.id > 10}}
Filter Objects
Filter Objects
Please Note

This filtering will work only if the raw response is in an object of an array format.

Filter Keys

In this section you can select the keys from the dropdown which you want to be filtered and the final transformed response will contain only those keys and the rest will be ignored.

Filter Keys
Filter Keys
Please Note

There are times when the keys might not be present while testing and you would still be able to configure them using the option keys missing?. Also this will work only on JSON data which isn't too nested.

With the above configurations in the filter objects and keys we can transform the Raw response below to the required transformed response:

Raw Response

[
{
"id": 10,
"avatar": "https://dronamobilepublic.s3.amazonaws.com/DRONA5_Team2050/content/app/images/public/dictaipsamet_V4FmM.png",
"fullname": "Santino Wyman",
"department": "Event Managemen",
"address": "jaipur",
"email": "santino.wyman@example.com",
"birthdate": "19-Jan-85"
},
{
"id": 12,
"avatar": "https://dronamobilepublic.s3.amazonaws.com/DRONA5_Team2050/content/app/images/public/laborumvoluptasporro_1kxD1.png",
"fullname": "Candace Kunze test",
"department": null,
"address": "81455 Lindgren Spurs test",
"email": "candace.kunze@example.com",
"birthdate": "19-Jan-78"
}
]

Transformed Response

[
{
"id": 12,
"fullname": "Candace Kunze test",
"department": null
}
]

Raw Response

This tab will save and show you the actual response received from the API or Database query.

Raw Response
Raw Response
Please Note

DronaHQ by default converts the Database responses in JSON format.

Transformed Response

This tab shows the transformed response after the transformations have been run. This will be the output of the data query that will be available across the app.

Transformed Response
Transformed Response

Advanced

In the advanced section you can write a condition when you don't want to execute this query. This is generally used in places where if there are dependent dynamic variables which send values like null on which you don't want to run the query. Also when you have JSON objects with keys which have special characters or emojis and you want to sanitize those keys you can toggle ON the Sanitize keys property.

Advanced
Advanced