Loading...
Loading...

Live Chat Icon For mobile
Hugo Morris

Chat with the Bold BI Sales team now!

Live Chat Icon
Row-level Security >Filter Parameters
Filter Parameters
This sample describes how to pass filter parameters to the embedded dashboard to apply filtering using JavaScript APIs.
How can you explore?

The Select Department listing lets you choose one or more departments to pass as filter parameter to the dashboard.The Select Days options lets you choose days range to pass as filter parameter to the dashboard.The Filter Query section shows the filter query with the parameter values passed through selection made. To explore this, choose one or more departments to pass as filter parameters to the current dashboard and click Apply to apply the filter.
Properties
Apply

Click to apply any setting changes above.

Code snippet that enables this functionality.


    public string GetDetails([FromBody] object embedQuerString)
    {
        var embedClass = Newtonsoft.Json.JsonConvert.DeserializeObject(embedQuerString.ToString());
        var embedQuery = embedClass.embedQuerString + "&embed_user_email=" + EmbedProperties.UserEmail  ;
        // Add your parameter values in the embed_datasource_filter
        embedQuerString += "&embed_datasource_filter=[{&Department=Accounting,Administration,Finance&Joined_Date=BETWEEN(2/8/2021 00:00 AM,10/20/2022 00:00 AM))}]";

        //To set embed_server_timestamp to overcome the EmbedCodeValidation failing while different timezone using at client application.
        double timeStamp = (int)DateTime.UtcNow.Subtract(new DateTime(1970, 1, 1)).TotalSeconds;
        embedClass.embedQuerString += "&embed_server_timestamp=" + timeStamp;
        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;
        }
    }