Embedded Reports and Export


#1

We are having lots of great luck using metabase for reporting and visualizations. Great work.
We have started trying to embed metabase into our web-based interface. While everything looks good we are making the filters accessible however we have encountered one issue. We can change the parameters of the filters (in this case they are date filters) and the report updates perfectly yet when we click the export button at the bottom (CSV or Excel) the report exports but none of the filters are applied. Has anyone else encountered this? Am I missing something configuration-wise?

Thanks

-dean


#2

Looking at this further, it seems that CSVexport when non embedded calls the API “query/csv” with a form post where parameters are placed in hidden inputs …

example:

<form class="mr1 text-uppercase text-default" method="POST" action="api/card/XX/query/csv">
<input type="hidden" name="parameters" value="[{&quot;type&quot;:&quot;date/single&quot;,&quot;target&quot;:[&quot;variable&quot;,[&quot;template-tag&quot;,&quot;start_date&quot;]],&quot;value&quot;:&quot;2017-10-01&quot;},{&quot;type&quot;:&quot;date/single&quot;,&quot;target&quot;:[&quot;variable&quot;,[&quot;template-tag&quot;,&quot;end_date&quot;]],&quot;value&quot;:&quot;2017-10-07&quot;}]"

When embedded it uses a different endpoint “/embed/question” for this call followed by the embed token and I do not see any hidden input elements as when this is used non-embedded.

<form class="mr1 text-uppercase text-default" method="GET" action="/embed/question/TOKEN.csv>

How are query parameters passed to the /embed/question endpoint? Is this the intention of the hash or should I expect to see form input elements as well? Seems to me that when embedded the filtering mechanism is not working correctly in some way but I’m not sure exactly what the intention of this is when embedded in an iframe.

Could really use some help here as this is holding up/limiting our ability to use Metabase significantly.

-dean


#3

hmmm. sounds like a bug, let me see if I can reproduce it.


#4

Thanks a ton Sameer! It definitely seems fishy. It seems to me that the buttons form token is always inherited from what is passed into the iframe. If I generate a token with the parameters specified the export works fine because it is using that token with the parameters but it does not seem that when you set the filters on the question that the token is repacked with the specified parameters at all. At least that is my guess based on inspecting the browser activity.

In addition, it seems that when you set the filters they are added as parameters on the iframe URL ie. ?start_date=DATE

If I try just hacking the url and saying url/token.csv?start_date=DATE that does not seem to works so there may be a disconnect between how tokens are used when embedding the question and how the csv/excel/json buttons are supposed to react to those changes.

Thanks again.

-dean


#5

Sameer, were you able to reproduce this issue? Thanks.


#6

I am using Metabase Public embed iframe on my web site. The metabase question has 2 parameters which I pass as querystring to iframe URL at load from my web site as the parameter values are dynamic in nature.

I am also facing the same problem as mentioned above by @PayloadDean. In my case, the excel output is always generated based on the default parameter, irrespective of the value I pass to iframe.

Has anyone found a solution for this?

Thanks in advance
Vineed


#7

I have the some issue reported by @PayloadDean and @vineed.menon, did you find any solution?

thank you in advance,
best regards,
Flavio


#8

Has this issue been solved ?