Can we restrict filter condition options for strings?

kv3
New Member

Hi,

I have a filter for string type and in the dropdown it shows 

efc90074-a8f1-4822-b16b-be94f9324bf6.png

the options based on which we can filter, Can we restrict these options for users somehow either through lookml or the ui?

The string column named “hashtags” might contain a list or a single word like:

  1. looker, bigquery, lookml, explore
  2. snowflake, looker
  3. looker

SO, when someone tries to filter with hashtag “is equals to” looker, it will show only 1 row  but when it will be like  hashtag “contains” looker, it will give all the 3 rows.

So, I want to restrict the option “is equals to” from the above list so that customer does not gets confused.

For example: say I just want the customer be only be able to filter through “contains” and disable/remove all other options for this filter.

or

is there a way in lookml where I can put condition within filter like say if customer choses “is equals to”, then filter using this sql condition , other wise use the other sql condition.

Solved Solved
1 7 2,619
1 ACCEPTED SOLUTION

Hi @kv3 

Adding on to @Eric_Lyons’s answer, you could create one more parameter which allows the end user to choose ‘Equals to’ or ‘Not Equals to’, which changes the sql in the yesno dimension based on the user’s chosen value

  dimension: contain_string {
    type: string
    sql: CONCAT('%',{% parameter parameter_named_string %},'%') ;;
  }
  
  parameter: contains {
    type: unquoted
    allowed_value: {label: "Equals to" value: ""}
    allowed_value: {label: "Not Equals to" value: "NOT"}
  }

  dimension: yesno_filter {
    type: yesno
    sql: ${state} {% parameter contains %} LIKE ${contain_string} ;;
  }

I’ve added some screenshots of how it would be used below:

30eea554-16a8-40c8-987b-24aba2a87a74.png
4aab1c00-c29d-4c9d-9559-ec240152fd6c.png

I hope this helps. Let me know if you have any questions

Naomi, Redkite

View solution in original post

7 REPLIES 7
Top Labels in this Space
Top Solution Authors