GitHub user j7282978-ops edited a discussion: Jinja Template - url_param not
working
Hi all,
I’m trying to embed a Superset dashboard in a React app using the Superset SDK.
I want to pass a parameter called survey_id via URL parameters and use it in my
dataset query:
SELECT *
FROM table
WHERE id IN ({{ url_param('survey_id') | default(3) | int }})
However, the query always defaults to 3 and doesn’t filter based on the value
I’m sending.
I’ve enabled the relevant feature flags in superset_config.py:
FEATURE_FLAGS = {
"ENABLE_TEMPLATE_PROCESSING": True,
"ALERT_REPORTS": True,
"EMBEDDED_SUPERSET": True
}
Here’s how I’m embedding the dashboard in React using embedDashboard:
const dashboardUiConfig = {
urlParams: {
survey_id: 6, // parameter to pass to Superset
...(permalinkKey ? { permalink_key: permalinkKey } : {}) // optional
},
filters: { expanded: false, visible: false }, // control filter visibility
hideTitle: true,
hideChartControls: true,
hideTab: true
};
// Example usage
embedDashboard({
id: DASHBOARD_ID,
supersetDomain: "http://localhost:8088",
mountPoint: document.getElementById("dashboard-container"),
dashboardUiConfig
});
Questions:
I want survey_id to be picked up by the dashboard query, but it always defaults
to the default(3) value.
Is there anything else I need to configure to make url_param work in this
embedded setup?
Any guidance or working examples would be greatly appreciated.
GitHub link: https://github.com/apache/superset/discussions/35480
----
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]