Active Query Builder Web API

Client for Javascript

Download the client for Javascript


You can download the ready-to-use client for Javascript using the "Download now" link below or install the package from the public repository. Using the package will let you keep the client up-to-date. Full source code is available at GitHub.

Direct Download

Download Active Query Builder Web API Client for Javascript:

Download now

Install using NPM

Use NPM package manager to add Active Query Builder Web API Client to your Javascript project:

npm install webapi-active-query-builder
NPM package

Source code on GitHub

Download and review source code of Active Query Builder Web API Client for Javascript on GitHub

Source on Github
Getting started with the client for Javascript
Create a new API provider
var api = new ActiveQueryBuilderApi();
Create a new Transform object
var transform = new Transform();
transform.guid = "9dbd355e-360e-430e-9cca-df6dd8b6d8d1"; //Metadata Guid from dashboard
transform.sql = "Select id, name from Person"; //Initial sql query
Add totals calculation
var max = new Totals();
max.field = 'id';
max.aggregate = Totals.AggregateEnum.Max;

var min = new Totals();
min.field = 'id';
min.aggregate = Totals.AggregateEnum.Min;

transform.totals = [max, min];
Define pagination
var page = new Pagination();
page.skip = 2;
page.take = 3;

transform.Pagination = page;
Setup sorting
var asc = new Sorting();
asc.field = 'id';
asc.order = Sorting.OrderEnum.Asc;

var desc = new Sorting();
desc.field = 'name';
desc.order = Sorting.OrderEnum.Desc;

transform.setSortings([asc, desc]);
Apply filters
var filter = new ConditionGroup();

var condition = new Condition();
condition.field = 'id';
condition.conditionOperator = Condition.ConditionOperatorEnum.Between;
condition.values = [1, 5];

filter.conditions = [condition];

transform.filter = filter;
Hide some columns
var column = new HiddenColumn();
column.field = 'id';
transform.hiddenColumns = [column];
Send request to the API
api.transformSQLPost(transform)
    .then(function (result) {
        var transformedSql = result.sql;
    })
    .catch(function(error) {
        //callback
    });
Get list of query columns
var query = new SqlQuery();
query.guid = "9dbd355e-360e-430e-9cca-df6dd8b6d8d1"; //Metadata Guid from dashboard
sql.text = "Select id, name from Person"; //Initial sql query
        
api.getQueryColumnsPost(query)
    .then(function (columns) {
        //callback
    })
    .catch(function(error) {
        //callback
    });