How do you add multiple liquid variables to a link in Looker?

I’ve followed this link https://docs.looker.com/reference/field-params/link on how to add a link to a dimension. 


So I was following this formula: 
 

dimension: artist_name {

link: {

label: "Google"

url: "http://www.google.com/search?q={{ value }}"

icon_url: "http://google.com/favicon.ico"

}

}

BUT, I need two different values in that URL link. For example, I need to add Lead ID and Client ID to that URL. And it only seems to work when you add one value. 

Solved Solved
0 5 2,210
1 ACCEPTED SOLUTION

Yes, it should work.  Below is an example.

dimension: product_brand {
    type: string
    sql: ${TABLE}.product_brand ;;
    link: {
      label: "Google"
      url: "http://www.google.com/search?q={{ value | url_encode }} + {{ inventory_items.product_department._value | url_encode }}"
      icon_url: "http://google.com/favicon.ico"
    }

View solution in original post

5 REPLIES 5

to reference additional fields you can use the liquid syntax {{ view.field._value }}

dimension: name {  link: {    label: "Drill Look"    url:"/looks/looknumber?&f[users.state]={{ value }}&f[users.region]={{ users.region._value }}"  }}

Would that work for url’s that don’t reference looker? Was hoping to use a URL that brought the person to an external website and I’ve tried that liquid syntax and it didn’t work

Yes, it should work.  Below is an example.

dimension: product_brand {
    type: string
    sql: ${TABLE}.product_brand ;;
    link: {
      label: "Google"
      url: "http://www.google.com/search?q={{ value | url_encode }} + {{ inventory_items.product_department._value | url_encode }}"
      icon_url: "http://google.com/favicon.ico"
    }

So I attempted what you had suggested using this formula (I’ve blocked out the first bit of the url for confidentiality reasons: 

  dimension: id {
    type: string
    sql: ${TABLE}.id ;;
    link: {
      label: "App Link"
      url: "……….clients/{{leads.client_id | url_encode}}/leads/{{value}}"
      icon_url: "……..”
  }

 but got this as a link:

…...clients/#%3CLooker::FieldDrop:0x1afa2613%3E/leads/15

instead of what it should have been here:

….. clients/1/leads/15
 

try

url: "……….clients/{{leads.client_id._value | url_encode}}/leads/{{value}}"

Top Labels in this Space
Top Solution Authors