Liquid: Checking in_query for a set of dimensions

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. 

Goal

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 %}

Prerequisites:

  • 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

https://community.looker.com/lookml-5/loop-through-list-of-fields-using-liquid-to-check-in-query-297...

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.
Best,
Jon

2 0 572
0 REPLIES 0
Top Labels in this Space
Top Solution Authors