Question

Passing parameters when creating url to the explore from dimension

  • 29 August 2019
  • 5 replies
  • 1235 views

Hello all! I need your help. Several days I try to understand how I should pass parameters in the following case.

I have a view with several dimensions and measures. I have a visualization using this view (just a table). When I click on one dimension I want to go to another explore. For this purpose I use “link” and “url”.


I do it the following way:

link: {

label: “Drilldown”

url: “…/explore/model_name/explore_name?fields=

field1,field2,field3…

&f[view_name.first_parameter]={{ first_parameter._parameter_value }}

&f[view_name.second_parameter]={{ second_parameter._parameter_value }}

&f[view_name.dimension_name]={{ value }}”

icon_url: “http://www.looker.com/favicon.ico

}


The link works, I can go to another explore. But I want to go to that explore using filters and parameters from the previous look, that is why I pass first_parameter, second_parameter and dimension_name.

Suddenly I don’t know why, but filters can be passed and parameters not. This line doesn’t work:

= {{ first_parameter._parameter_value }}

the same is when I use:

= {% first_parameter._parameter_value }

It just returns todays date (the type of the parameter is date).

Maybe you have any ideas how I can pass parameters to another explore?


Thank you very much in advance.


5 replies

Userlevel 7
Badge +1

Interesting, I’m seeing parameters being fine to be referenced with pretty much the same logic.


If filters are working, is there a reason you need to use parameters for this specific case? Some screenshots might also be helpful.


Could you paste in the full URL returned by that drill logic? If you right click and select “Copy Link Address” and paste that in (without any private information) it could be helpful for troubleshooting.

Hi!


Thank you for answer! I can describe the situation in more details.


I have a dashboard with several looks that are displayed as the bar chart diagrams. I have several parameters on the dashboard - start date, end date, country, and venue name. All these parameters are connected to the looks. Start date and end date are parameters that mean the period of time for which data will be chosen. Country and venue name are parameters that addresses to the fields in the database. So actually start date and end date are parameters that were written in a view as

parameter: start_date {type: date }

parameter: end_date {type: date }

And other 2 parameters (country and venue name) are just filters that were written as dimensions in the view.


We need double drill down for every diagram on this dashboard. First drill down is displayed when we click on the diagram and 11 columns should appear in that drilldown. And the second drill down should be when we click on the venue name in this first drill down. I hope I described this step clear…


The issue is that we cannot create such a double drilldown because in the second drill down the same columns are displayed as in the first drilldown but we need those columns and 5 more for the second drill down(!). So it can be said that we need a little bit different set of columns.


That is why I found out that the best solution for this case is to use drill down and then to go to the explore from this first drilldown using a link. So this link is displayed for every row for the first drill down.


And when I click on this link I go to the separate explore with all columns that I need. Also I pass those 4 parameters that I told about - 2 parameters start_date/end_date and 2 filters - country and venue name. Unfortunately it is not enough to use only filters because the data is filtered using those 2 parameters start-date and end_date.


And that is ok with filters - country and venue name can be passed easily to the explore from the dashboard using this code:


&f[view_name.country]={{ country._value }}

&f[view_name.venue_name]={{ value }}


(I didn’t wrote venue_name._value because all this code is written for venue_name dimension because we click on venue_name in the table for first drill down).


Unfortunately I cannot send good screenshots because there are private data… But hope I described it well. Also I send full URL with some data replacement.


dimension: venue_name {

link: {

label: “Drilldown”

url: “looker_instance/explore/model_name/explore_name?fields=

view_name.id,

view_name.dimension1,

view_name.dimension2,

view_name.country,

view_name.dimension4,

view_name.venue_name,

view_name.calculation1,

view_name.calculation2,

view_name.calculation3,

view_name.calculation4,

view_name.calculation5,

view_name.calculation6,

view_name.calculation7,

view_name.calculation8,

view_name.dimension5,

view_name.dimension6,

view_name.dimension7

&f[view_name.p_start_date]={{ p_start_date._parameter_value }}

&f[view_name.p_end_date]={{ p_end_date._parameter_value }}

&f[view_name.network]={{ network._value }}

&f[view_name.venue_name]={{ value }}”

icon_url: “http://www.looker.com/favicon.ico

}

type: string

sql: ${TABLE}.“VENUE_NAME” ;;

}


And everything is working fine except this thing with start_date and end_date parameters. All fields are displayed, I can go to the needed explore, all other filters can be passed from the dashboard…

When the new explore with this drilldown appears I can see start_date and end_date parameters and filters country and venue name. So parameters start date and end date are passed but they always have only TODAY value by default but not the value that I pass from the dashboard.


I thought that maybe that is because these parameters has date datatype but seems that issue is in something other.


Thank you very much in advance!

I attach 1 screenshot. @hen the new explore appears I can see all these 4 filters and parameters. Tha last 2 filters (country and venue name) are always passed but the first 2 filters (start date and end date) always have TODAY date.


Thank you!


image

Userlevel 7
Badge +1

Got it, thank you for the detailed explanation! I think this is happening for the same reason as what’s being discussed here:



The parameter_value of that parameter is actually the SQL string TIMESTAMP('2019-02-04 00:00:00') (to pick a random date), and when that’s fed into the filter portion of the URL, it thinks “woah, I don’t know what that means” and just defaults to showing today.


This is an interesting puzzle. What if you change it to use this syntax:

&f[view_name.p_start_date]={{ _filters['p_start_date']}}? I have a strange feeling that that will work— Since it’s capturing the actual filter configuration of the field there, rather than dumping the raw “parameter value” which doesn’t seem to be working.

Thank you very much! That helped me a lot!!!


I thought that it was an issue with parameters of any type but really it was only regarding date parameters.


Also in my case there was an issue that I split this link to several rows just to have a readable code but when I used what you said + wrote that link in one row, everything worked fine.


Thank you very much one more time! 🙂

Reply