One feature of drill menus is to link to URLs. This can be used to link from a dimension to any valid URL (including to external URLs) or to Explores within Looker. Read more about drill menus in the drill_fields
documentation.
This article will walk you through how to link to external URLs, Explores, and Looker dashboards from the drill menu.
Linking to External URLs
We can link to external URLs using the links
parameter in a dimension or measure. This lets you specify the label
of the link, the url
, and the icon_url
.
label
is the name this link will have in the drill menu.url
is the URL of the link. This parameter supports full liquid (but not full HTML). Read about how to use liquid in Looker here.icon_url
is the URL of an image to be used as an icon for this link. This also supports liquid.
Example:
Let's say I have a dimension with an artist name, and I want to link to a Google search about that artist. I can create an external link that uses the artist's name in the URL like so:
dimension: artist_name {
link: {
label: "Google"
url: "http://www.google.com/search?q={{value}}"
icon_url: "http://google.com/favicon.ico"
}
sql: ${TABLE}.artist_name ;;
}
This will create an option in the drill menu of the artist name dimension, that opens the option to Google for this artist:
Linking to Looker Dashboards
If we have an Artist Dashboard in Looker, we can use the same syntax from the above example, to provide a drill there.
Example:
dimension: artist_name {
link: {
label: "Artist Dashboard"
url: "/dashboards/[DASHBOARD_ID]?Artist%20Name={{ value }}"
icon_url: "http://looker.com/favicon.ico"
}
sql: ${TABLE}.artist_name ;;
}
Linking to Other Explores
Linking in drill menus can be used to link to any valid URL. This includes Explore URLs within Looker. So drill menu links can be used to create custom linking between different Explores. This is very similar to creating a custom drill using html. (Read about how to create a custom Explore link here.)
Here's a generic example of a link to a Looker Explore:
dimension: a_super_cool_dimension {
link: {
label: "Another Awesome Explore"
url: "/explore/model/explore_name?fields=view.field_1,view.field_2,view.field_3&f[view.filter_1]={{ value }}&pivots=view.field_2"
icon_url: "http://www.looker.com/favicon.ico"
}
sql: ${TABLE}.cool_dimension ;;
}
When the url
of a drill menu link begins with /explore/
, the link will appear under the Explore section of the drill menu. For example:
Other Uses of Drill Menus:
Read more about:
- More Powerful Drilling
- Drilling to dashboards (in labs)
- Visual Drilling (in labs)