Dynamic warning icon and help text

menew
New Member

Hi all,

I'm looking for some help building some dynamic warnings and help text for my users. When they use an explore I want to give them a little warning icon when they make common configuration errors (choosing certain dimensions and filters together isn't recommended).

The approach I'm currently trying is to render the icon and help message such that a user will see it when they step on one of these known configuration landmines in a Look or dashboard. As far as I can tell, this means I need to render the icon using Liquid in the html and label of every field because these are the only lookml-configurable things that respond to the necessary Liquid variables (_in_query, _is_filtered) and are always visible to a user working on a Look or a dashboard.

What I've done so far amounts to writing a massive Liquid expression with a bunch of conditionals (comparing the _is_filtered and _in_query properties of all my fields) and dropping this giant expression into every single HTML and label of all of my fields. This actually works quite well (as in it the warning and help message show up correctly in dashboards and Looks), and the LookML itself is autogenerated so I'm not too worried about maintainability.

However, this approach creates another problem. Because I have so much text in the file, Looker fails when trying to evaluate the LookML.

One way to fix this is to make the Liquid less duplicative. The most promising solution looks like the Liquid include tag https://liquidjs.com/tags/include.html but everything I've tried results in Looker failing LookML validations saying "problem with evaluating include";. I've tried every permutation of using extensions, not using extensions, using .lkml files, .liquid files, no extension files, and so on, but I always arrive at the same "problem with evaluating include". Below is a sample of what my include attempts have looked like:

{% assign includefile = 'includefile.liquid.lkml' %}
{% include includefile %}

I've also made sure to `include: "includefile.liquid.lkml"` in case that matters.

Interested in help at any step of the process here. I'm running out of ideas.

1 1 38
1 REPLY 1

This is such a cool use case. I'm really curious to hear if others have taken similar approaches.

I don't think includefile will work here, but that doesn't mean we can't still define the Liquid in a separate file. Have you looked into defining this logic into a LookML constant?