Apply multiple filters in embedded dashboard #34020
Replies: 2 comments 2 replies
-
|
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: 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. 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. To reply, just mention @dosu. How did I do? Good | Irrelevant | Incorrect | Verbose | Hallucination | Report 🐛 | Other |
Beta Was this translation helpful? Give feedback.
-
|
hi I already follow your instruction to apply urlParams but it's still not working @dosu |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
I want to add multiple filter clauses like this - filter1 & filter2 in the superset sdk api, how to do that for embedded superset dashboard?
I am trying like this, but its not workinf-
<Superset reportId="id"
filterClause={[
{
clause: 'site_id=28'
},
{
clause: 'price>10'
}
]}
/>
Superset version: 5.0.0
@dosu Can you help
Beta Was this translation helpful? Give feedback.
All reactions