Introduction:  Helical Insight metadata connects with a database which is predefined. Now there might be certain cases in which we would like the metadata to connect to different data sources based on certain condition.

For example : In healthcare industry the data of the hospital can not go outside the hospital premises. In that case, based on which hospital user has logged in, the metadata should connect to a different physical database.

Note: This solution will work if the DBName, table name, column name and schema is same, even though the physical server, DB credentials etc could be different.

We can switch database based on logged-in username, organization , role and profiles.

Switching the database based on logged-in user name :

In this example we have two mysql databases having names : hiadmin, hiuser

having common table : userdetails

Step1 : Create managed connection for both databases :

Dynamic Database Switching Based On Certain Conditions In Helical Insight 5 Onwards

Once the Test Connection is successful then Save Datasource

Dynamic Database Switching Based On Certain Conditions In Helical Insight 5 Onwards

Once the Test Connection is successful then Save Datasource

Dynamic Database Switching Based On Certain Conditions In Helical Insight 5 Onwards

Once the connection id will be assigned dynamically. In above example 1001 and 1002 are connection id’s.

Step2 :    Open Advanced option in data source module and click on “Groovy Managed JdbcDataSource

Dynamic Database Switching Based On Certain Conditions In Helical Insight 5 Onwards

Step3 : If you create new connection, it will open a place holder with a sample groovy code for the reference

(We need to write/ change the logic for switch database based on username)

Dynamic Database Switching Based On Certain Conditions In Helical Insight 5 Onwards

Step4 :  Updated sample code logic to switch the database based on username

import groovy.sql.Sql;

import net.sf.json.JSONObject;

import com.helicalinsight.adhoc.metadata.GroovyUsersSession;

public JSONObjectevalCondition() {

JSONObjectresponseJson = new JSONObject();

String userName = GroovyUsersSession.getValue('${user}.name');

userName = userName.replaceAll("'", "");

if (userName.equals("hiadmin")) {

responseJson.put("globalId", 1001);

}

//below is the example - please put the globalId of managed connection as per requirement

if (userName.equals("hiuser")) {

responseJson.put("globalId", 1002);

}

 

responseJson.put("type", "global.jdbc");

 

//throw new RuntimeException("This is a test exception" +responseJson);

return responseJson;

}

Additional Information of the groovy code :

String userName = GroovyUsersSession.getValue('${user}.name');

This code will give us value of currently logged-in username

String orgName = GroovyUsersSession.getValue('${org}.name');

This code will give us value of currently logged-in user organization name

String roleName = GroovyUsersSession.getValue('${role}.name');

This code will give us value of currently logged-in user role

String profileValue = GroovyUsersSession.getValue('${profile[\'ProfileName\']}')

This code will give us value of currently logged-in username profile value.

responseJson.put(“globalId”, 1002) – this will set the data source connection mapping to use that specific connection which we created in manged connection.

We can use any of the above parameters like username, org name , roles and profile values for mapping required data source connection ID

Step5 :Provide updated groovy code in place holder and provide Datasouce Name then click on “Browse” option

Dynamic Database Switching Based On Certain Conditions In Helical Insight 5 Onwards

Create a new folder by clicking below highlighted icon

Dynamic Database Switching Based On Certain Conditions In Helical Insight 5 Onwards

Dynamic Database Switching Based On Certain Conditions In Helical Insight 5 Onwards

Select Use This Folder

Dynamic Database Switching Based On Certain Conditions In Helical Insight 5 Onwards

Dynamic Database Switching Based On Certain Conditions In Helical Insight 5 Onwards

Click on Test Connection

Once the it is successful then “Save Datasource”

Step 6 : Create metadata

Dynamic Database Switching Based On Certain Conditions In Helical Insight 5 Onwards

Remove the Catalog Name and save the metadata ( it should be changed dynamically )

Dynamic Database Switching Based On Certain Conditions In Helical Insight 5 Onwards

Save the metadata in a separate folder

Step7 : Create a report using the metadata , since we are creating report with hiadmin user

So the data connection pointed to hiadmin database and giving the result as expected

Dynamic Database Switching Based On Certain Conditions In Helical Insight 5 Onwards

Dynamic Database Switching Based On Certain Conditions In Helical Insight 5 Onwards

Step8 :  we need to check the same report with “hiuser” also in order to check if database is switching based on user name or not

For that we should share reports and metadata with that specific user

Dynamic Database Switching Based On Certain Conditions In Helical Insight 5 Onwards

Step9 : Login with hiuser and open the report

Dynamic Database Switching Based On Certain Conditions In Helical Insight 5 Onwards

The data is changed by switching the connection based on username. Hence the database switching is worked fine.

Helical Insight’s self-service capabilities is one to reckon with. It allows you to simply drag and drop columns, add filters, apply aggregate functions if required, and create reports and dashboards on the fly. For advanced users, the self-service component has ability to add javascript, HTML, HTML5, CSS, CSS3 and AJAX. These customizations allow you to create dynamic reports and dashboards. You can also add new charts inside the self-service component, add new kind of aggregate functions and customize it using our APIs.
Helical Insight’s self-service capabilities is one to reckon with. It allows you to simply drag and drop columns, add filters, apply aggregate functions if required, and create reports and dashboards on the fly. For advanced users, the self-service component has ability to add javascript, HTML, HTML5, CSS, CSS3 and AJAX. These customizations allow you to create dynamic reports and dashboards. You can also add new charts inside the self-service component, add new kind of aggregate functions and customize it using our APIs.
Helical Insight, via simple browser based interface of Canned Reporting module, also allows to create pixel perfect printer friendly document kind of reports also like Invoice, P&L Statement, Balance sheet etc.
Helical Insight, via simple browser based interface of Canned Reporting module, also allows to create pixel perfect printer friendly document kind of reports also like Invoice, P&L Statement, Balance sheet etc.
If you have a product, built on any platform like Dot Net or Java or PHP or Ruby, you can easily embed Helical Insight within it using iFrames or webservices, for quick value add through instant visualization of data.
If you have a product, built on any platform like Dot Net or Java or PHP or Ruby, you can easily embed Helical Insight within it using iFrames or webservices, for quick value add through instant visualization of data.
Being a 100% browser-based BI tool, you can connect with your database and analyse across any location and device. There is no need to download or install heavy memory-consuming developer tools – All you need is a Browser application! We are battle-tested on most of the commonly used browsers.
Being a 100% browser-based BI tool, you can connect with your database and analyse across any location and device. There is no need to download or install heavy memory-consuming developer tools – All you need is a Browser application! We are battle-tested on most of the commonly used browsers.
We have organization level security where the Superadmin can create, delete and modify roles. Dashboards and reports can be added to that organization. This ensures multitenancy.
We have organization level security where the Superadmin can create, delete and modify roles. Dashboards and reports can be added to that organization. This ensures multitenancy.
We have organization level security where the Superadmin can create, delete and modify roles. Dashboards and reports can be added to that organization. This ensures multitenancy.
We have organization level security where the Superadmin can create, delete and modify roles. Dashboards and reports can be added to that organization. This ensures multitenancy.
A first-of-its-kind Open-Source BI framework, Helical Insight is completely API-driven. This allows you to add functionalities, including but not limited to adding a new exporting type, new datasource type, core functionality expansion, new charting in adhoc etc., at any place whenever you wish, using your own in-house developers.
A first-of-its-kind Open-Source BI framework, Helical Insight is completely API-driven. This allows you to add functionalities, including but not limited to adding a new exporting type, new datasource type, core functionality expansion, new charting in adhoc etc., at any place whenever you wish, using your own in-house developers.
It handles huge volumes of data effectively. Caching, Pagination, Load-Balancing and In-Memory not only provides you with amazing experience, but also and does not burden the database server more than required. Further effective use of computing power gives best performance and complex calculations even on the big data even with smaller machines for your personal use. Filtering, Sorting, Cube Analysis, Inter Panel Communication on the dashboards all at lightning speed. Thereby, making best open-source Business Intelligence solution in the market.
It handles huge volumes of data effectively. Caching, Pagination, Load-Balancing and In-Memory not only provides you with amazing experience, but also and does not burden the database server more than required. Further effective use of computing power gives best performance and complex calculations even on the big data even with smaller machines for your personal use. Filtering, Sorting, Cube Analysis, Inter Panel Communication on the dashboards all at lightning speed. Thereby, making best open-source Business Intelligence solution in the market.
With advance NLP algorithm, business users simply ask questions like, “show me sales of last quarter”, “average monthly sales of my products”. Let the application give the power to users without knowledge of query language or underlying data architecture
With advance NLP algorithm, business users simply ask questions like, “show me sales of last quarter”, “average monthly sales of my products”. Let the application give the power to users without knowledge of query language or underlying data architecture
Our application is compatible with almost all databases, be it RDBMS, or columnar database, or even flat files like spreadsheets or csv files. You can even connect to your own custom database via JDBC connection. Further, our database connection can be switched dynamically based on logged in users or its organization or other parameters. So, all your clients can use the same reports and dashboards without worrying about any data security breech.
Our application is compatible with almost all databases, be it RDBMS, or columnar database, or even flat files like spreadsheets or csv files. You can even connect to your own custom database via JDBC connection. Further, our database connection can be switched dynamically based on logged in users or its organization or other parameters. So, all your clients can use the same reports and dashboards without worrying about any data security breech.
Our application can be installed on an in-house server where you have full control of your data and its security. Or on cloud where it is accessible to larger audience without overheads and maintenance of the servers. One solution that works for all.
Our application can be installed on an in-house server where you have full control of your data and its security. Or on cloud where it is accessible to larger audience without overheads and maintenance of the servers. One solution that works for all.
Different companies have different business processes that the existing BI tools do not encompass. Helical Insight permits you to design your own workflows and specify what functional module of BI gets triggered
Different companies have different business processes that the existing BI tools do not encompass. Helical Insight permits you to design your own workflows and specify what functional module of BI gets triggered