User Guide Getting Started Help Center Documentation Community Training
New LookML
Old LookML
New LookML
Looker
  
English
Français
Deutsch
日本語
link

Usage

view: view_name {
  dimension: field_name {
    link: {
      label: "desired label name"
      url: "desired_url"
      icon_url : "url_of_an_image_file"
    }
    # Possibly more links
  }
}

Hierarchy

link

Possible Field Types

Dimension, Measure

Accepts

Various parameters

Definition

The link parameter makes it easier and more useful to add Looker links and other external links to your dimensions and measures. The form of a link parameter is:

dimension: field_name { link: { label: "desired label name" url: "desired_url" icon_url: "url_of_an_image_file" } # Possibly more links }

The link parameter has several child parameters:

For example, you can use the link parameter to direct users to related Looker Explores or dashboards that aren’t automatically generated by using drill_fields. For example, this is one URL format often used to direct to a related Explore:

dimension: city { sql: ${TABLE}.metro ;; link: { label: "Another Awesome Explore" url: "/explore/model/explore_name?fields=view.field_1,view.field_2,&f[view.filter_1]={{ value }}" icon_url: "https://looker.com/favicon.ico" } }

That dimension would produce a link menu like the one below:

The example above includes a sql parameter. If sql is left unspecified, then Looker assumes that there is a column in the underlying table with the same name as the field.

Link Behavior

When the user clicks on a link, Looker will open the link in either a new browser tab or in the same tab (or iframe, for embedded queries):

A user must have either the explore or see_drill_overlay permission to access links.

Liquid Variables

The link parameter supports Liquid variables to make links dynamic. For example, suppose you had an artist_name dimension, and wanted the user to have the option of executing a Google search for that artist. You could use the value Liquid variable to create a dimension like the following:

dimension: artist_name { link: { label: "Google" url: "http://www.google.com/search?q={{ value }}" icon_url: "http://google.com/favicon.ico" } }

The user’s experience for this dimension link would look like this:

Passing a Query’s Filter Values Into a Link

Another Liquid variable supported by the link parameter is _filters['view_name.field_name']. This variable takes the values entered for a filter and passes them on to a linked query, dashboard, or Look.

If you are passing the filter from a dashboard, the _filters['view_name.field_name'] must refer to a field type filter.

Here is an example of a dimension that uses the _filters variable in its link parameter:

dimension: name { link: { label: "Business Pulse By State Dashboard" url: "https://learn.looker.com/dashboards/694?State={{ _filters['users.state'] | url_encode }}" } }

In this example, if a user filters a query on the users.state dimension, the linked dashboard is automatically filtered by the same states chosen for the original query. Including the Liquid filter url_encode in this example ensures that filter values containing special characters like spaces can be passed to the linked dashboard by converting URL-unsafe strings into percent-encoded strings.

In the example below, the user has filtered a query by the state “California.” The link opens a dashboard that is already filtered on the state of California:

This also works for passing filter values to linked Looks and Explores:

dimension: name { link: { label: "Average Order Profit Look" url: "https://learn.looker.com/looks/249?&f[users.state]={{ _filters['users.state'] | url_encode }}" } link: { label: "User Facts Explore Explore" url: "https://learn.looker.com/explore/ecommerce/users?fields=users.id,users.name&f[users.state]={{ _filters['users.state'] | url_encode }}" } }

Also note that you can pass multiple filters using &, such as in the URLs specified below:

dimension: name { link: { label: "Business Pulse By State Dashboard" url: "https://learn.looker.com/dashboards/694?State={{ _filters['users.state'] | url_encode }}&Date={{ _filters['orders.date'] | url_encode }}" } link: { label: "Average Order Profit Look" url: "https://learn.looker.com/looks/249?&f[users.state]={{ _filters['users.state'] | url_encode }}&f[orders.date]={{ _filters['orders.date'] | url_encode }}" } }

Linking to Dashboards and Looks: Please keep in mind that a linked dashboard or Look must be configured with a filter that can accept the specified filter values. In the example above, the “Business Pulse by State” dashboard is configured with a filter on users.state, so that _filters['users.state'] information in the link can be applied to the dashboard.

If a dashboard or Look does not have a filter that can use the passed values, the link will still work, but the filter values will not be applied to the dashboard. For information on creating dashboard filters, see this page for LookML dashboards and this page for user-defined dashboards.

Linking to Explores: When setting up a URL for an Explore, open the Explore in a browser and add a filter. Then, from the Explore’s gear menu, select Share and then copy the Expanded URL. In the expanded URL you can see where the filter values are specified and replace them with your _filters variable. See this Community topic for information on the parts of a query URL.

Using link to Customize Drill Visualizations

If your Looker admin has enabled the Visual Drilling Labs feature, you can customize the visualization displayed in the drill overlay by using the link parameter and Liquid variables.

Here is an example of setting a drill visualization to a scatter chart:

measure: count { type: count_distinct sql: ${id} ;; drill_fields: [created_date, total_sale_price] link: { label: "Drill as scatter plot" url: " {% assign vis_config = '{\"type\": \"looker_scatter\"}' %} {{ link }}&vis_config={{ vis_config | encode_uri }}&toggle=dat,pik,vis&limit=5000" } }

See the More Powerful Data Drilling Community topic for more examples of customizing drill visualizations.

Top