Articles in this section
Category / Section

How to handle server-side filtering with dashboard parameter in design mode embedding of dashboard?

Published:

In JavaScript embedding, you may encounter issues with filter parameters not working in design mode. This article will provide you with an alternative solution to filter data values in design mode using embed_datasource_filter query parameter.

  1. We have Bold BI embedded samples on different platforms which you can download from here. In the provided samples, the dashboard renders in view mode by default.
  2. Make the necessary changes in the downloaded sample by referring to the help documentation to render the dashboard in design mode.
  3. Now include the embed_datasource_filter query parameter and follow the instructions provided in the documentation to implement it in your project.
public string GetDetails([FromBody] object embedQuerString)
       {
           var embedClass = Newtonsoft.Json.JsonConvert.DeserializeObject<EmbedClass>(embedQuerString.ToString());
           var embedQuery = embedClass.embedQuerString;
           // User your user-email as embed_user_email
           embedQuery += "&embed_user_email=" + EmbedProperties.UserEmail;
           double timeStamp = (int)DateTime.UtcNow.Subtract(new DateTime(1970, 1, 1)).TotalSeconds;
           embedQuery += "&embed_server_timestamp=" + timeStamp;
           embedQuery += "&embed_datasource_filter=" + "[{&Year(OrderDate)=2022}]";
           var embedDetailsUrl = "/embed/authorize?" + embedQuery + "&embed_signature=" + GetSignatureUrl(embedQuery);
           using (var client = new HttpClient())
           {
               client.BaseAddress = new Uri(embedClass.dashboardServerApiUrl);
               client.DefaultRequestHeaders.Accept.Clear();
               var result = client.GetAsync(embedClass.dashboardServerApiUrl + embedDetailsUrl).Result;
               string resultContent = result.Content.ReadAsStringAsync().Result;
               return resultContent;
           }

       }

Here, we added the embed_datasource_filter query parameter with a filter value of &Year(OrderDate)=2022. Below image demonstrates the corresponding dashboard in design mode.

image.png

By following these steps, you should be able to filter data values in design mode using embed_datasource_filter query parameter.

Additional References

How to handle server-side filtering with parameters in a dashboard

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