Articles in this section
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:
  1. 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:
  1. 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.
  2. 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:

Was this article useful?
Like
Dislike
Help us improve this page
Please provide feedback or comments
SM
Written by Soundarya Mani Meharan
Updated
Comments (0)
Please  to leave a comment
Access denied
Access denied