view_label

LookML
Version

On this Page
Docs Menu

Go to Join Parameter List

This page refers to the view_label parameter that is part of a join

view_label can also be used as part of an explore, described here

view_label can also be used as part of a dimension, measure, or filter field as described here

Usage

view_label is a child of
join is a child of
joins is a child of
explore
explore: view_name_1
joins:
join: view_name_2
...
1st
Tab
2nd
Tab
3rd
Tab
view_label: 'desired label'
a string

Definition

view_label will change the way that a group of fields from a joined view will be labeled in the Field Picker:

Generally speaking, view_label should only be used when you need more than one view for modeling purposes, but those views represent the same entity to your business users. For example, you might have a customer view and customer_facts view, and want them to retain those names for modeling purposes. However, it might make sense for both of them to appear as Customer to business users.

If you do not explicitly add a view_label to a join, the view_label defaults to the name of the join.

If you want to change the names of the fields themselves, you can use the label parameter.

Examples

Make the customer_facts view appear to be part of the customer view in the Field Picker:

- explore: customer joins: - join: customer_facts view_label: 'Customer' sql_on: ${customer.id} = ${customer_facts.customer_id}

Make the product_facts view appear to be part of the product_info view in the Field Picker:

- explore: product_info joins: - join: product_facts view_label: 'Product Info' sql_on: ${product_info.product_id} = ${product_facts.product_id}

Common Challenges

view_label Has No Effect Other Than Changing The Field Picker Appearance

When you change the view_label of a join, only the Field Picker is affected. The way that fields should be referenced in the LookML remains unchanged.

Use Proper Capitalization When Combining Multiple Views Via view_label

If you want a joined view to be merged with another view in the Field Picker, you’ll need to make sure that the capitalization you use in view_label is correct. The capitalization you use should match how the view name appears in the Field Picker. Take this example:

- explore: product_info joins: - join: product_facts view_label: 'Product Info' sql_on: ${product_info.product_id} = ${product_facts.product_id}

The way that product_info will appear in the Field Picker is Product Info; each word is capitalized, and underscores and changed to spaces. For this reason, we used view_label: 'Product Info' instead of view_label: 'product_info'.

Things to Know

There Are Several Ways To Re-label A Joined View

LookML has several different ways to re-name a joined view, all of which have different effects on the way that you write LookML. view_label is not appropriate for all use cases. This is a brief summary of how to re-name a view:

Situation Proper LookML
Name a view differently than its underlying table, both in the Field Picker and when writing LookML sql_table_name for views
Name a joined view differently than its underlying view, only in the Field Picker view_label for joins
Join the same view to an explore multiple times, and apply a unique name to each case, both in the Field Picker and when writing LookML from for joins
If the same view can describe several different tables, choose the table to be used sql_table_name for joins
Still have questions?
Go to Discourse - or - Email Support
Top