Dynamic filters (List of numbers)

dingo
New Member

Hello, I have a requirement where I need to allow users to enter program numbers dynamically and I should take those numbers and display results.

For Ex, In the derived table SQL, 
SELECT * FROM TABLE WHERE programId IN (1,2,3,4,5,6);

I want to allow the program numbers to be entered by users dynamically. i.e, Users should enter 1,2,34,5,6.

How do I achieve this in Looker? I cant use Templated filters  since they are only for logical results (i.e, program =’1’ ). Can I use parameters in SQL derived table? I couldn’t find documentation for doing this with parameters too. 


Can someone please help? Thanks in Advance.

Solved Solved
0 7 1,964
1 ACCEPTED SOLUTION

Hello @dingo 

You are on the right track! 

Parameters is not an option in this case as it does not allow to pass multiple values.

But templated filters should work. Whether a user enters one value or multiple values, it will adjust the query to  “= value” or “in(value1, value2, ...)”.

Something like this should work:

  filter: number_list {
    type: number
    default_value: "1"
  }

...and then just add the templated filter in your derived table.

{% condition number_list %} sql_or_lookml_reference  {% endcondition %}

 

View solution in original post

7 REPLIES 7
Top Labels in this Space
Top Solution Authors