Solved

Link not passing query parameter

  • 7 January 2021
  • 5 replies
  • 153 views

I currently have a view that has a link that should pass an ID in as a query parameter to the next dashboard. Relevant parts of the definition of the view, field being used in the link, and link is as follows:

view: my_old_view {
dimension: id {
type: string
sql: ${TABLE}.id ;;
}

link: {
label: "Winners"
url: "/dashboards/analytics::my_new_dashboard?Drawing+ID={{ my_old_view.id | url_encode }}"
}
}
}

The new dashboard has a filter called “Drawing ID” that is applied to tiles within the dashboard but the query parameter doesn’t seem to getting passed through. The URL I would expect would be https://looker.instance.url/dashboards-next/analytics::my_new_dashboard?Drawing+ID=1234567890 where “1234567890” is the ID that I click on from the original dashboard. Instead, the URL looks like https://looker.instance.url/dashboards-next/analytics::my_new_dashboard?Drawing+ID= with no ID and I’m not sure why this is happening.

icon

Best answer by Maddie 8 January 2021, 18:32

Hi Maikerusan,

 

I think this can be solved if you make the following change:

 

view: my_old_view {
dimension: id {
type: string
sql: ${TABLE}.id ;;
}

link: {
label: "Winners"
url: "/dashboards/analytics::my_new_dashboard?Drawing+ID={{ value }}"
}
}
}

 

Let me know if it works!

 

Best,

View original

5 replies

Userlevel 2

Hi Maikerusan,

 

I think this can be solved if you make the following change:

 

view: my_old_view {
dimension: id {
type: string
sql: ${TABLE}.id ;;
}

link: {
label: "Winners"
url: "/dashboards/analytics::my_new_dashboard?Drawing+ID={{ value }}"
}
}
}

 

Let me know if it works!

 

Best,

@Maddie That works perfectly thank you!! We have other looks that are passing in the view’s ID by doing something like “view_name.id” but I guess there is something else going on behind the scenes that may be allowing this work? I realize it’s hard to answer without being able to see everything but would you happen to have any idea  why using the “view_name.id” works in the other scenarios? Maybe because they are legacy looks from before newer versions of Looker or something like that?

Userlevel 2

No problem! Glad it worked.

 

I am not sure, to be honest, it could also be because we need some other characters in there:

 

view: my_old_view {
dimension: id {
type: string
sql: ${TABLE}.id ;;
}

link: {
label: "Winners"
url: "/dashboards/analytics::my_new_dashboard?Drawing+ID={{ ['my_old_view.id'] | url_encode }}"
}
}
}

.. or it could be the new dashboard?

 

Let me know if this new solution above works!

 

Best,

Hmm. Seems to throw an error doing that. “Error processing liquid. undefined method `gsub' for 1000896353:Integer”. Almost certainly something I’m doing on my end that I can go through and research another time. But the previous solution is working so I’m all set on my end. Thank you!

Userlevel 2

It could be something as basic as changing the type of your dimension to number based on that error. 

 

Glad it all worked out!

 

Best, 

Reply