GitHub user dosubot[bot] added a comment to the discussion: Apply multiple
filters in embedded dashboard
<!-- Answer -->
The filterClause prop isn’t supported for embedding dashboards in Superset
5.0.0. To apply multiple filters, you need to use the urlParams property inside
dashboardUiConfig when calling the embedDashboard function from the Superset
Embedded SDK. Specifically, you should use the preselect_filters URL parameter,
which takes a JSON object mapping chart IDs to column/value arrays. Each field
is ANDed together, and within a field, multiple values are treated as an IN
clause.
Here’s a simplified example:
```js
embedDashboard({
id: "your-dashboard-id",
supersetDomain: "https://your-superset-instance",
mountPoint: document.getElementById("dashboard"),
fetchGuestToken: async () => "your-guest-token",
dashboardUiConfig: {
urlParams: {
preselect_filters: JSON.stringify({
// Replace with your actual chart IDs and column names
"123": { site_id: [28] },
"456": { price: [/* values here, but only equality/IN supported */] }
})
}
}
});
```
Note: Only equality and IN-style filters are supported this way; complex
clauses like price > 10 aren’t natively supported via embedding—only direct
value matches are possible. For more, see the [Superset Embedded SDK
README](https://github.com/apache/superset/blob/308007f909b5a3c1cdd6fc5632ef27ca7eb97ce0/superset-embedded-sdk/README.md).
If you need to filter on ranges (like price > 10), you’ll need to configure a
native filter in the dashboard itself and preselect its value using
preselect_filters, but the embedding API doesn’t support arbitrary SQL
expressions in filters.
<!-- Dosu Comment Footer -->
*To reply, just mention [@dosu](https://go.dosu.dev/dosubot).*
---
<sup>How did I do?
[Good](https://app.dosu.dev/response-feedback/0c5f38bd-8725-4abb-ad5d-466ce662d4c2?feedback_type=great_response)
|
[Irrelevant](https://app.dosu.dev/response-feedback/0c5f38bd-8725-4abb-ad5d-466ce662d4c2?feedback_type=irrelevant_answer)
|
[Incorrect](https://app.dosu.dev/response-feedback/0c5f38bd-8725-4abb-ad5d-466ce662d4c2?feedback_type=incorrect_sources)
|
[Verbose](https://app.dosu.dev/response-feedback/0c5f38bd-8725-4abb-ad5d-466ce662d4c2?feedback_type=too_verbose)
|
[Hallucination](https://app.dosu.dev/response-feedback/0c5f38bd-8725-4abb-ad5d-466ce662d4c2?feedback_type=hallucination)
| [Report
🐛](https://app.dosu.dev/response-feedback/0c5f38bd-8725-4abb-ad5d-466ce662d4c2?feedback_type=bug_report)
|
[Other](https://app.dosu.dev/response-feedback/0c5f38bd-8725-4abb-ad5d-466ce662d4c2?feedback_type=other)</sup> [](https://go.dosu.dev/discord-bot) [](https://twitter.com/intent/tweet?text=%40dosu_ai%20helped%20me%20solve%20this%20issue!&url=https%3A//github.com/apache/superset/discussions/34020)
GitHub link:
https://github.com/apache/superset/discussions/34020#discussioncomment-13636382
----
This is an automatically sent email for [email protected].
To unsubscribe, please send an email to:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]