Managing Data Source Field Updates in Bold BI via API: Adding, Renaming, and Deleting Columns
In Bold BI, it is essential to keep the data source synchronized with any changes made to the underlying dataset schema. This includes scenarios such as adding, deleting, or renaming fields (columns) in the source data. This article provides a comprehensive guide on how to refresh data source fields in Bold BI when schema changes occur.
Scenario
Consider a Microsoft SQL Server database table named “Order Details” that is connected to Bold BI.
After successfully transferring the table to the query designer page and preserving the data source, the data is integrated into a widget and published on a dashboard.
API Request Details
To update the data source fields, use the following API request:
Input | |
---|---|
URL | http://{domain}/bi/api/site/{sitename}/v4.0/datasources/columns |
Method | Put |
Content Type | application/json |
Authorizations | bearer token How to generate Access Token from User Management Server using Bold BI REST API? |
Request Body Schema:
[
{
"DataSourceId": "string"
}
]
Handling Column Changes
When changes occur in the dataset schema, it is crucial to update the data source in Bold BI accordingly. This includes handling the following scenarios:
1. Adding Columns
- When new fields are added to the underlying dataset, ensure that these fields are included in the data source by following the above API request process. In the dataset, we have included the Product Name, Order Date, and Shipped Date.
Before Adding the columns:
After Adding the columns:
2. Renaming Fields
- If a field has been renamed, update the data source accordingly through the API to reflect the new field name. In this instance, we have changed the ProductName to ItemName.
3. Deleting Columns
-
If a field is removed from the underlying dataset, it is important to delete the corresponding field from the data source in Bold BI to maintain synchronization. In this instance, we have removed the column titled ‘ItemName’.
-
If you remove a column that is linked to a widget, you may encounter data retrieval issues upon refreshing the dashboard page. To resolve this, please refresh the data source through the API after deleting the column.