Category / Section
How to create a data source and edit the existing data source in JavaScript embedding?
Published:
In JavaScript embedding, we have the option to create a data source and edit the specific data source. Here, we are going to demonstrate creating and editing a specific data source using JavaScript-based embedding.
Steps to create a data source in an embedded application:
- We have embedded samples on different platforms, you can download them from the help documentation. In the provided sample, by default, the dashboard renders in view mode. To create the data source using the downloaded sample, change the BoldBI.create() method like in the below code snippet.
function renderDashboard() {
this.dashboard = BoldBI.create({
serverUrl: rootUrl + "/" + siteIdentifier,
embedContainerId: "dashboard",
mode: BoldBI.Mode.Connection,
embedType: BoldBI.EmbedType.Component,
environment: environment == "enterprise" ? BoldBI.Environment.Enterprise : BoldBI.Environment.Cloud,
width: "100%",
height: "100%",
expirationTime: 10000,
authorizationServer: {
url: authorizationServerUrl
}
});
this.dashboard.loadDatasource();
};
2. Once you make these changes, run the embedded application to create a data source.
Steps to edit the existing data source in an embedded application:
- To edit the data source in an embedded application, get the data source ID from the Bold BI server and provide this value in "datasourceId" API then change the BoldBI.create() method like in the below code snippet.
function renderDashboard() {
this.dashboard = BoldBI.create({
serverUrl: rootUrl + "/" + siteIdentifier,
datasourceId:"f91fb59f-5189-44ae-9747-32dfe92c2c19",
embedContainerId: "dashboard",
mode: BoldBI.Mode.DataSource,
embedType: BoldBI.EmbedType.Component,
environment: environment == "enterprise" ? BoldBI.Environment.Enterprise : BoldBI.Environment.Cloud,
width: "100%",
height: "100%",
expirationTime: 10000,
authorizationServer: {
url: authorizationServerUrl
}
});
this.dashboard.loadDatasource();
};
2. Once you make these changes, run the embedded application to edit a data source.
Note: you can also edit the data source using data source name to implement this refer to the help documentation.
Related topics:
- To know more about different JavaScript embedding, dashboard embedding, dashboard designer embedding, pinboard embedding, and widget embedding.