View the original community article here
Last tested: Jan 14, 2020
When we are creating a custom filter with more than 50 boolean evaluations we will see the error nesting of 101 is too deep
. For example, we will generate this error if we have a custom filter like this:
${orders.id} = 1 OR
${orders.id} = 2 OR
${orders.id} = 3 OR
…
${orders.id} = 50 OR
${orders.id} = 51
With more than 50 boolean evaluations, we get too deep. We have two options to resolve this:
Solution 1: LookML yesno field
We can create a dimension of type: yesno that will run this evaluation that we can then use as a frontend filter. This would look something like this:
dimension: one_to_fifty {
type: yesno
sql: ${id} = 1 OR
${id} = 2 OR
${id} = 3
…
${orders.id} = 50 OR
${orders.id} = 51;;
}
Solution 2: Use matches_filter( ) function
If we want to avoid making any LookML developments or need to be able to modify the filters from the front end we can compress all these individual boolean evaluations into a single evaluation using the matches_filter( ) function. The logic that would for this filter function would look like this:
matches_filter(${orders.id}, `1,2,3,... 50,51`)
Some extra context on this in this Community post
This content is subject to limited support.