Liquid: Checking in_query for a set of dimensions

  • 3 August 2022
  • 0 replies

Hey Everyone, 
Hope you are all fine and well! 

I know basic liquid in the realm of looker but now I have a more complex task at hand for which I’d love some support. Hopefully some of you could help. 


What I’d love to achieve is checking a list of potential dimensions (10+ dimensions)  that could be used in a query  and output the effective list of used dimensions in some sort of array or list or constant. 

What I’ve seen as a starter is this from the mentioned source below
(but not sure if this can work):

{% assign potential_grouping_dims = 'field_name_1,field_name_2,field_name_3’ | split: ',' %}

{% assign grouping_dims = ‘’ %}

{% for dim in potential_grouping_dims %}

{% assign assigned_dim_in_query = 'view_name_1.' | append: dim | append: '._in_query' %}

{% if assigned_dim_in_query %}

{% assign grouping_dims = grouping_dims | append: dim | append: ',' %}

{% endif %}

{% endfor %}



  • I know that you could check every single dimension by itself but this is very repetitive coding
  • I have around 10-15 dimensions I want to check
  • I’d love to output some sort of constant,variable,array (whatever) with all the actually used dimensions in the query (which would’ve been checked with some sort of loop)


Other sources found

Here I found a similar topic. Unfortunatly no solution was provided. Hence, I am hoping for more luck with my topic. 
My actual usecase is similar to the one stated in the topic above. 


Or is there another, more cleaner way to achieve said goal without using liquid?



Many thanks in advance for your support.



0 replies

Be the first to reply!