Can I conditionally display a `link`?

Knowledge Drop

Last tested: May 11, 2020
 

Yes, but only using liquid conditional logic (meaning we cannot show a link in one dashboard but not another, unless they are in a separate model, explore, etc. - there's a feature request here to +1).

A link defined with the link parameter will only display if a URL is associated with the link. We can use liquid to conditionally input a URL, or leave it blank but not putting an else statement.

Over-simplified example:

 

dimension: foo {

link: {

label: "Link Label"

url:

"

{% if _explore._name == 'bar' %}

/dashboards/1234

{% endif %}

"

}

}

This will show the link in one explore, but not others:

Explore_Users_and_Explore_Order_Items.png

This content is subject to limited support.                

Version history
Last update:
‎07-07-2021 03:12 PM
Updated by: