Using HTML and Link parameters at the same time

(Haley Baldwin) #1

I have some measures/dimensions where I’m trying to utilize both the HTML parameter and the Link parameter in the LookML. But whenever I add in HTML, the Link no longer works. Is this a known issue and is there any way around it?


(Izzy) #2

The secret here is to use {{ linked_value }} in your html parameter instead of just {{ value }}. That preserves the link and the html!

1 Like

(Haley Baldwin) #3

I think my situation is a little weird because I’m not using {{ value }} anywhere in the HTML, so I can’t replace it with {{ linked_value }}. The measure I’m using is an aggregation of multiple entries, using PostgreSQL string_agg. And I’m using HTML to split each entry onto a new line. This method works, but if I add a link parameter, the link does not work. I assume there’s probably a better way to do this though.

measure: field_list {
  type: string
  sql: string_agg(distinct ${TABLE}.field, ',');;
       {% assign field_array = field_list | split:"," %}
       {% for i in field_array %}
           {{ i }}
       {% endfor %} ;;

I’ve also tried bypassing the HTML by using the PostgreSQL new line character as the delimiter like this:
sql: string_agg(distinct ${TABLE}.field, E'\n');;

And that works in sql, but does not display correctly in Looker. Instead of a new line, it shows a space between each entry.


(Haley Baldwin) #4

This page about Liquid Variables says that you can get “unexpected results” when using liquid with an aggregate measure. That’s exactly what I’m trying to do, so that explains why it’s not working.


(Izzy) #5

Ahh got it. I don’t think there’s a way to preserve the link unless you’re using linked_value, which I guess wouldn’t be possible in your case. I can’t think of a way to get it to work, unless you manually added the link to the html block— You could add an icon with an img tag and have an href anchor to the link in question…

Anyone have a better way?