Linking to URLs in drill menus (3.40+)

#1

As of Looker 3.40, we have added customizable drill menus. Read more about drill menus here.

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.

Linking to external URLs

You can link to 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.

  1. label is the name this link will have in the drill menu.
  2. 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.
  3. icon_url is the URL of an image to be used as an icon for this link. This also supports liquid.

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:

Old LookML
  - dimension: artist_name
    links:
    - label: Google
      url: http://www.google.com/search?q={{value}}
      icon_url: http://google.com/favicon.ico
    sql: ${TABLE}.artist_name
New LookML
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 to go to Google for this artist:

Linking to Looker Dashboards

If you have an Artist Dashboard in Looker, you can use this same syntax to provide a drill there:

Old LookML
  - dimension: artist_name
    links:
    - label: Artist Dashboard
      url: /dashboards/[DASHBOARD_ID]?Artist%20Name={{ value }}
      icon_url: http://looker.com/favicon.ico
    sql: ${TABLE}.artist_name
New LookML
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 drills using html.

Read about how to create a custom explore link here.

Here’s a generic example of a link to a Looker explore:

Old LookML
  - dimension: a_super_cool_dimension
    links:
    - 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
New LookML
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:

  1. Drilling into a row by any other dimension value

  2. Drilling to dashboards (in labs)

  3. Drilling in visualizations (in labs)

2 Likes

Hierarchical Drilling and Drill Menus (3.40+)
Linking to dashboards in drill menus (3.40+)
Drill menus in visualizations (3.40+)
Set a mailto link using drill field URLs
Looker 3.40 Release Notes
Considerations when Building Performant Looker Dashboards
How to achieve conditional drill within the same pivot report
Html to link to custom explore?
(Leland) #2

Really enjoying the Links feature! However, I’ve noticed that the linking becomes disabled in data tables when implementing custom HTML defined in LookML. Interestingly, the drill menus are still available in the visualization when you click through the vis, just not when you click in the table.

Is there any specific HTML I can inject into the following that might bring back the drill menu?

html: | {% if order.terminal_percent._value == 0 %} <span style="color: orange">{{ rendered_value | append: ' (Not Terminal)' }}</span> {% elsif order.terminal_percent._value < 75 %} {% capture new_var %} {{ rendered_value }} ({{ order.terminal_percent._rendered_value }}% Terminal){% endcapture %} <span style="color: orange">{{ new_var }}</span> {% else %} <span style="color:grey">{{ rendered_value }}</span> {% endif %}

0 Likes

#3

@Leland_Robbins I recommend using {{ linked_value }} instead of {{ rendered_value }}. linked_value should preserve any existing drilling/drill menus on the dimension value.

0 Likes

(Brad Ruderman) #4

@lindsey A revamp of liquid templating is much needed. Would be great to build better drill downs and cross linking using liquid templating. Not sure if its possible to create dynamic cross linking on measures such that you can pass the filters and dimensions to different models but it would be super cool!!

1 Like

(Brett Sauve) #5

Please note that @Leland_Robbins example above uses {{ capture }}, which is no longer permitted as of Looker 3.48 for security reasons.

0 Likes

(Ovi Hentea) #6

Worth mentioning what the documentation suggests in terms of capturing the icon:

To find .ico files, try running a Google search with the pattern http://www.google.com/s2/favicons?domain=[company website of interest]

Worked wonderfully for me - make sure to include the whole domain, e.g. http://www.google.com/s2/favicons?domain=reddit.com

1 Like

(Wil Gieseler) #7

This favicon finder tool is also a great option and has options for higher-resolution images.

It’s also worth noting that thie icon_url parameter can accept any image format web browsers can commonly load, not just .ico files.

1 Like

(Maire Newton) #8

For each old LookML code block in this article and its comments, we just added the New LookML equivalent code.

0 Likes

(Tig Newman) #9

For each old LookML code block in this article and its comments, we just added the New LookML equivalent code.

0 Likes