dosubot[bot] commented on issue #35884: URL: https://github.com/apache/superset/issues/35884#issuecomment-3461136317
<!-- Answer --> Yes, you can apply filters to an embedded slice (chart) via the /explore/ URL by passing filter parameters in the form_data query parameter. The recommended way is to add a form_data parameter containing a JSON-encoded string with extra_filters or adhoc_filters. These will be merged with the saved slice state and applied to the chart when rendered. For example, to filter a column named "country" to only show "US", you can use: ``` https://my_superset_domain.com/explore/?slice_id=154&standalone=1&form_data={"slice_id":154,"extra_filters":[{"col":"country","op":"==","val":"US"}]} ``` If you want to specify multiple values (e.g., "US" and "CA"), use the IN operator: ``` https://my_superset_domain.com/explore/?slice_id=154&standalone=1&form_data={"slice_id":154,"extra_filters":[{"col":"country","op":"IN","val":["US","CA"]}]} ``` Make sure to URL-encode the form_data value. If you use form_data_key, you cannot override filters directly in the URL; you must generate a new form_data_key with the desired filters included in the saved state. References: - [How /explore/ merges extra_filters and adhoc_filters from form_data](https://github.com/apache/superset/blob/master/superset/views/utils.py) - [Slice model and explore URL construction](https://github.com/apache/superset/blob/master/superset/models/slice.py) - [Discussion on specifying multiple filter values in URL](https://github.com/apache/superset/discussions/32754) <!-- 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/c86a312c-6128-48ef-8e5c-1e08fd4f02e0?feedback_type=great_response) | [Irrelevant](https://app.dosu.dev/response-feedback/c86a312c-6128-48ef-8e5c-1e08fd4f02e0?feedback_type=irrelevant_answer) | [Incorrect](https://app.dosu.dev/response-feedback/c86a312c-6128-48ef-8e5c-1e08fd4f02e0?feedback_type=incorrect_sources) | [Verbose](https://app.dosu.dev/response-feedback/c86a312c-6128-48ef-8e5c-1e08fd4f02e0?feedback_type=too_verbose) | [Hallucination](https://app.dosu.dev/response-feedback/c86a312c-6128-48ef-8e5c-1e08fd4f02e0?feedback_type=hallucination) | [Report 🐛](https://app.dosu.dev/response-feedback/c86a312c-6128-48ef-8e5c-1e08fd4f02e0?feedback_type=bug_report) | [Other](https://app.dosu.dev/response-feedback/c86a312c-6128-48ef-8e5c-1e08fd4f02e0?feedback_type=other)</sup> [](https://app.dosu.dev/a28d3c7e-a9d3-459e-9fb6-3a6f9ff4f357/ask?utm_source=githu b) [](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/issues/35884) -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
