Duplicate Views in Field Picker Using View_Label

Knowledge Drop

Last tested: Oct 21, 2020
 

Looker has an article about cool ways to use Liquid when labeling, but if you use Liquid in a view_label in one location, say for a field, but use a static string for view_label in another location, like the explore, you will see duplicate view labels in the field picker. ex: Liquid with view_label in view: Spaces in Liquid Name.png

Static view_label in explore:

Static Name in Explore.png

Result in Field Picker:

Duplicate Views in Field Picker.png

WHAT IS HAPPENING

The line breaks that help make the Liquid easier to read actually add spaces into the view_label, effectively making the labels different. ex: From explore: "My Awesome Name" From view: "My Awesome Name "

To resolve this, remove any spaces/characters between each the liquid tags where you are defining the view name that you are trying to match. ex: No Spaces for view_label.png

THE RESULT

Your field picker only has one view label for your custom name! Single View Label.png

Note: I left spaces between the {% else %} and Gobbleydegook because I wasn't trying to match another view_label defined else where. If you have other Liquid conditions that need to match other view_labels, be sure to remove any white spaces between Liquid tags in those cases as well.

 

This content is subject to limited support.                

Version history
Last update:
‎05-07-2021 09:09 AM
Updated by: