SITUATION
I have parameter and filter and this is the LOOKML:
parameter: attr {
type: unquoted
description: "Name of the event attribute for condition 3."
}
filter: string_val {
type: string
description: "String value of the event attribute for condition 3."
}
The value of those are as follows:
attr = 'page_name'
string_val = 'home/$(pages)/name'
However, the generated SQL by Looker is:
WHERE page_name = ‘home/pages/name’
For some reason, looker is not generating the special characters in the value.
ATTEMPT #1
The parameter and filter is being utilized in derived table within the LookML as:
AND {% condition string_val %}
{% parameter attr %}
{% endcondition %}
Then the attempt to solve the issue is to use the url_encode which I found somewhere in this site.
AND {% condition string_val | URL_ENCODE %}
{% parameter attr %}
{% endcondition %}
But it's not working. The special characters in the value are still not showing in the generated SQL.
ATTEMPT #2
After that attempt, I tried to create another parameter and use type: unquoted
{% if unquoted_val._parameter_value == blank %}
{% else %}
AND {% parameter attr %} = '{% parameter unquoted_val | escape %}'
{% endif %}
parameter: unquoted_val {
type: unquoted
description: "Unquoted value of the event attribute for condition 2."
}
parameter: attr {
type: unquoted
description: "Name of the event attribute for condition 3."
}
However, I’m getting an error because unquoted parameters only contain underscore, numbers, letters, “.” and “$”.
The use case is a bit unusual and there’s no article about this. Hoping someone can help me. Thanks!