The Dynamic Connection String feature enables you to modify the connection string of the data sources in dashboard view mode. This feature allows you to view the dashboard with modified connection string on Bold BI application itself and also to the dashboards embedded using the Dashboard Embedding feature as well.
NOTE: To embed the Bold BI application, refer Embed Bold BI documentation.
While creating live mode connections, you need to configure a Web API that will return the modified connection string.
On dashboard rendering, the configured API will be triggered for each data source created with Dynamic Connection String Configuration. Based on the response from the API the connection string will be updated in the data source and the dashboard will be rendered.
If the API is not reachable or if the API returned any errors then the dashboard will be rendered with an error stating that the connection is not valid.
Create any live mode connection such as MSSQL, MySQL, PostgreSQL etc.
In the connection input form, click the Dynamic Connection String switch to enable the Dynamic Connection String feature for the data source.
Click the Configure button to open the Dynamic Connection Configuration dialog.
In the Dynamic Connection Configuration dialog, fill the form for the Web API and click Save. The API will be validated by triggering the API with a Head request. Make sure that the provided API has HTTP HEAD method support.
At the bottom of the dialog, there is an option pinned to choose the Configuration Mode and User Identity for the Dynamic Connection Configuration.
Configuration Mode
The mode in which the Dynamic Connection String should function also can be used to limit the functionality to the embedded application or within the server or both.
Embedding | Allows to render the dashboards with modified connection string only when the dashboards are embedded using the Dashboard Embedding feature |
Server | Allows to render the dashboards with modified connection string only on Bold BI application itself |
Both | Allows to render the dashboards with modified connection string on both Bold BI application and dashboards embedded using the Dashboard Embedding feature as well |
User Identity
The Identity that should be passed to the Custom Web API, in order to enhance the usage of modified connection string at run time. This can holds the logged in user information as Email
and Full Name
After saving the configuration, complete the data source creation.
NOTE: The configuration can be modified or removed any time by navigating to Edit Connection dialog for the data source.
We can use any technology to create the Web API. The return type and the content type of the API should be JSON.
The following arguments will be passed by the Dashboard Service when triggering the API.
Arguments
requiredParams | Comma separated values. The API should return the value with the keys mentioned in the argument. Eg: MSSQL required Parameters for the connection string are `DataSource, InitialCatalog, Username, Password, IntegratedSecurity,AdvancedSettings, CommandTimeout, Schema` |
datasourceName | Name of the data source |
datasourceId | GUID of the data source as string. |
customIdentity | The string value that holds the user identity information based on the identity type chose on Dynamic Connection String Configuration. Also it can be override while the dashboard embedded using the Dashboard Embedding feature |
identityType | The string value that holds the type of the user identity chose on Dynamic Connection String Configuration either `Email` or `Full Name`. Also it should be `Custom` while custom identity is passed on dashboard embedded using the Dashboard Embedding feature |
NOTE: During the validation of head request the above arguments will not be passed to the API.
Return Type
Type: ApiResponse class
public class ApiResponse
{
public bool Status { get; set; }
public string Message { get; set; }
public object Data { get; set; }
}
The API should return the response as the above Class object.
APIResponse Class Properties
Status | Represents whether the action is successful or not. Set as true if the response is valid connection string. |
Message | Holds the status message it can be a simple “Success” or an error message when the status is false. |
Data | Holds the Connection string builder data. |
Example Response
{
Status: true,
Message: "Success",
Data: {
DataSource: "<server>",
InitialCatalog: "<database>",
Username: "<username>",
Password: "<password>",
IntegratedSecurity: "false",
AdvancedSettings: "",
CommandTimeout: "300"
}
}
NOTE: If the response is invalid or the connection string is invalid then the dashboard will not be rendered. An error message will be shown on the widgets.
The custom identity can be passed to the viewer only when the dashboard embedded using the Dashboard Embedding feature.
The custom identity should be passed through the API dynamicConnection.
Example
var dashboard = BoldBI.create({
dynamicConnection: {
isEnabled: true,
identity: "",
}
});
dashboard.loadDashboard();
NOTE: The value of the identity property should be a string. This string will not be processed at the Bold BI end. This information will be passed to the API without any modifications.
While configuring the Dynamic Connection String for a dashboard’s data source using the same Database with different Schema, we can use the required parameter Schema
on the modified connection string.
So the API response from the Custom Web API should includes the connection parameter Schema on modified connection string.
Example Response
{
Status: true,
Message: "Success",
Data: {
DataSource: "<server>",
InitialCatalog: "<database>",
Username: "<username>",
Password: "<password>",
IntegratedSecurity: "false",
AdvancedSettings: "",
CommandTimeout: "300",
Schema: "<schema>"
}
}