Product+Name={{value}} didn't encode comma properly

when I am exploring a dashboard by filtering the dashboard on product name using Product+Name={{value}} in dashboard link, it can’t encode comma properly and treating it like two separate names. example I have a product name as Mountain-400-Silver,46 , it is showing like this.Please help me to solve this issue.

8ccb9e26-cb90-4f3d-8c80-d0996c2910ed.png
0 2 464
2 REPLIES 2

To solve the problem of commas in product names not being recognized properly in Looker, you can use URL encoding. URL encoding replaces special characters with their ASCII hexadecimal value preceded by a percent sign. In this case, the comma (,) needs to be encoded as %2C.

Existing: Product+Name={{value}}
Modified: Product+Name={{value | url_encode}}

By using the url_encode filter, you ensure that special characters, like commas, are encoded correctly in the URL.
When providing the product name as a filter value, make sure to encode it beforehand. For example, if the product name is "Mountain-400-Silver,46", the encoded value will be "Mountain-400-Silver%2C46".

For ref: https://cloud.google.com/looker/docs/reference/param-field-link#liquid_variables

Roderick
Community Manager
Community Manager

To solve this issue, you need to encode the comma in the product name using the url_encode() function. The url_encode() function will convert special characters into their corresponding encoded values. For example, the following code will encode the comma in the product name:

Code snippet

{{ _filters['product_name'] | url_encode }}

Use code with caution. Learn more

content_copy

This will produce the following URL:

Code snippet

https://my-looker-dashboard.com/?product_name=Mountain-400-Silver%2C46

Use code with caution. Learn more

content_copy

The comma in the product name will now be encoded, and the dashboard will be filtered correctly.

Here are the steps on how to encode the comma in the product name using the url_encode() function:

  1. Go to the Dashboard Editor.
  2. In the Filters section, click on the Add Filter button.
  3. Select the Text filter type.
  4. In the Filter Name field, enter a name for the filter.
  5. In the Filter Value field, enter the product name.
  6. Click on the Save button.

The filter will now be added to the dashboard. To encode the comma in the product name, you need to use the url_encode() function. The url_encode() function is a LookML function that converts special characters into their corresponding encoded values.

To use the url_encode() function, you need to add it to the Filter Value field. The following code shows how to use the url_encode() function to encode the comma in the product name:

Code snippet

{{ _filters['product_name'] | url_encode }}

Use code with caution. Learn more

content_copy

This will produce the following URL:

Code snippet

https://my-looker-dashboard.com/?product_name=Mountain-400-Silver%2C46

Use code with caution. Learn more

content_copy

The comma in the product name will now be encoded, and the dashboard will be filtered correctly.

Top Labels in this Space
Top Solution Authors