Metabase API Dashboard - PUT

I have a dashboard and one of the questions should display a Map View with a fallback: If the results are from multiple countries, display question with World Map; if the results are only from US, display question with US Map per state.

While Embedding it, my two main options were:

  • Having 2 dashboards and change between them based on the data;
  • Using Metabase API to replace the questions and then filter it;

Both ways I have the experience of all the questions reloading and some "flashes".

The only way so far is now GET the dashboard, check the dashcards, change the card_id I need and send the PUT with the new entire dashboard. It works, but the reloading experience is not good.

Do I have any other options here?

Hey there, I would go with the first option "Having 2 dashboards and change between them based on the data".

I would rely heavily on javascript:

  1. A basic query returning a boolean if results are from multiple countries.
  2. Using Metabse API call the query above.
  3. Based on the boolean value, render a dedicated dashboard.

How does it sound?