metabase icon indicating copy to clipboard operation
metabase copied to clipboard

Inconsistency in category values between question embed and dashboard embed

Open paoliniluis opened this issue 3 years ago • 1 comments

Describe the bug If you embed a question that has a field filter as a parameter, then the filter in the embedded view will show all the categories, but if you embed that same question inside a dashboard and add a connected category, it will only show values that exist for the card (as if it was a linked filter)

Logs NA

To Reproduce

  1. enable embedding
  2. create a SQL question like:
SELECT ((floor((("products"."price" - 12.5) / 12.5)) * 12.5) + 12.5) AS "products", sum("public"."orders"."total") AS "sum"
FROM "public"."orders"
LEFT JOIN "public"."products" ON "public"."orders"."product_id" = "products"."id"
LEFT JOIN "public"."people" ON "public"."orders"."user_id" = "people"."id"
WHERE {{category}} and {{id}}
GROUP BY ((floor((("products"."price" - 12.5) / 12.5)) * 12.5) + 12.5)
ORDER BY ((floor((("products"."price" - 12.5) / 12.5)) * 12.5) + 12.5) ASC

(category is a field filter to product.category and id is a field filter to people.id 3) embed the card only with ID being locked and category being editable. Pass an ID in the JWT and see that the filter will show all the values in the category, no matter the ID in the locked filter image

  1. Now add the question to a dashboard and add 2 filters: category and ID, link those filters and embed the dashboard with Id being locked and category editable. Pass an ID to the dashboard and see how Metabase will show only the categories that have a row in the DB and correspond to the ID being passed (much like as a linked filter works) image

NOTE: User I'm using on the JWT has ID 4, not 1 as the images tell

Expected behavior We should provide a consistent experience if you embed a dashboard or a question

Screenshots See in the repro

Information about your Metabase Installation:

  • Your browser and the version: Brave latest
  • Your databases: Postgres 12
  • Metabase version: 1.44.4
  • Metabase hosting environment: Docker
  • Metabase internal database: H2

Severity P3

Additional context Walked by this bug while checking ticket 12527

paoliniluis avatar Oct 01 '22 01:10 paoliniluis