Could you help me with one tricky functionality I am trying to implement in Looker.
Let me provide the background to be able to recommend me options.
I have a dashboard with a button, that is linked to Look. I have a filter “shipping_address_country_code” on the dashboard and in the Look.
My task: get filter value from Dashboard and auto apply to the Look. The tricky moment is that I want to do it NOT in the dimension but in Button URL.
So the use case is
User opens the dashboard
User selects a filter “shipping_address_country_code” = NL
User clicks on the button
User sees Look
User sees filter “shipping_address_country_code” on the Look with auto-applied filter value “shipping_address_country_code” = NL
So the code example from LookML model of the dashboard.
#Button Send the selection
type: button
name: button_243
rich_content_json: ‘{“text”:“Send selection”,“description”:“Send your selection
to Google Ads after the final check of your customers”,“newTab”:true,“alignment”:“center”,“size”:“large”,“style”:“FILLED”,“color”:“#80868B”,
“href":"https://crystalloids.eu.looker.com/looks/56?Orders={{_filters[orders.shipping_address_country_code]| url_encode}}&f[orders.shipping_address_country_code]”}’
These code examples work for the dimension but not for the button. Could you consult me if my scenario is can be implemented and if yes, what should I correct in the code to reach the result.
I know in the original reply you stated that you don’t want to use a dimension, but you can replicate a button pretty well using a dimension. You can set up a button using a “single value” type tile and use the HTML attribute. In this example I’m using a parameter value, not a filter, but the idea is the same.
In this example, I set a variable named your_param first. It is pulling a value from a filter named size_of_range. Then using {{ your_range }} I put the rendered value into the URL parameter of the dashboard I’m linking to.
@clathrop Thanks for this, do you know if there is a similar way to use the current dashboards filter values as input to the href link here instead of a parameter?
@jonvitale-16770 replace the parameter in the braces with a liquid filter variable " _filters[‘view_name.field_name’] " for the field you will be filtering in your dashboard, and that should do the trick. Adapting @clathrop 's example, it would look something like this: