SO embedded dashboard - set dashboard filter as part of URL?

ihayes
Participant III

With a SSO embedded dashboard, is it possible to set the starting filter value for a dashboard level filter?

0 9 3,030
9 REPLIES 9

Yes you should be able to changes the filter using
?Filter_name=Filter_value&Filter_name2=Filter_value[&...]
in the embed_path of the URI

ihayes
Participant III

What filter name would I use for a dashboard level filter?

The filter name as displayed, or the explore/view.field name?

The filter name as is on the dashboard which will then propagate the right value for explore.view.field_name throughout the concerned tiles/looks.

Hi Ian,

You can find the filter name in the dashboard url as well.

For example for this dashboard with these filters below, the url looks like this https://demo.looker.com/embed/dashboards/4608?State=California&City=&Traffic%20Source=Email

ihayes
Participant III

That’s not working for me…

If I add…

"?filter_field=filter_value’

… to the embed path that is part of the string that is converted to an encrypted secret then I get an authentication error…

Single sign on failure. Please contact an administrator.

I need clarification on where/how the filter parameter is added to the full embedded URL

a). is the filter field parameter added to the embedPath element that is part of the string that is encryped?
b). If so, how should that filter element appear in the final URL?

Hey @ihayes
Works for me 🤔

for the embed_path can you try this format (lookML dashboard):
'/embed/dashboards/[model]::[Dashboard Name]%3F[Filter name]%3D[Filter Value]'

ihayes
Participant III

Thanks…
I solved it
My mistake was to assume that the ‘?’ used to prefix the dashboard filter parameter meant that the other query parameters required a ‘&’ join rather than a ‘?’.

The Looker SSO API syntax Its a little odd but I’ve got it working now.

Hi Ian!

I have the same issue, but when I added the filter to the SSO link, prior or after to it being signed, the iframe trying to embed it prompted for a looker login. Did you have this problem?

When did you add the filter? Was it after or before it being signed?

Thanks in advance!

FYI if someone else needs help with this. 

The filter needs to be added before being signed and in the embed path. (change filtername and filtervalue to the corresponding dashboard values you have). 

The key is to ensure that you put the ? before the path gets encoded (when it changes to the corresponding %3F).

(example using php sample code from https://github.com/looker/looker_embed_sso_examples/blob/master/sso_embed.php)

<?php
date_default_timezone_set('America/Los_Angeles');

$secret = "<your_secret_here>";

$embedpath= "/embed/dashboards/3?filtername=filtervalue";

$host = "<your_looker_endpoint>";
$path = "/login/embed/" . urlencode($embedpath);

...

Further down the code the full URL gets built and the “actual” ? gets incorporated there directly as the full URL without further encoding. (line 75 from the above link)

$final = "https://" . $host . $path . "?" . $querystring;