Solved

Is it possible to rename fields when joining a view to a explore?

  • 28 October 2020
  • 4 replies
  • 1945 views

I would want to rename a field when doing the join of a view into a explore, to have a more descriptive name for that use case. Is there a way to do this?

icon

Best answer by kevin.dunn 28 October 2020, 21:36

View original

4 replies

Userlevel 1

Hey @Maria_Garcia_Gumbao,

 

Great question. We can label fields to give them a more descriptive name in general, but we don’t have any native LookML parameters at the join level that would let you rename the field based on the join.

 

That being said, the label parameter for fields can be made dynamic using liquid, and we could reference the _explore._name variable inside of some conditional logic to accomplish something like this - Something like:

 

dimension: field {
...
label:
"
{% if _explore._name == 'Explore One' %}
field_name_one
{% else %}
field
{% endif %}
"
}

 

Let me know if there’s anything I can clarify!

Thank you! I think that could be a good solution

This is a great solution. The only confusion I ran into when implementing it was

“...== ‘Explore One’ %}”


This made me think I needed to use the name of the explore as viewed. But it needs to be the name of the explore as it resides in the LookML. So I would modify the original response to look more like:

“...== ‘explore_one’ %}”

Hope this helps others save the few moments of questioning why it isn’t working.

I have a use case where I need this, but I need to join the same View multiple times to an Explore, and create a new name for the joined field for every join

 

Is this possible in Liquid as well?

Reply