User Guide Getting Started Help Center Documentation Community Training
New LookML
Old LookML
New LookML
Looker
  
English
日本語
view_label (for Joins)

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 on this documentation page.

view_label can also be used as part of a dimension, measure, or filter, described on this documentation page.

Usage

explore: view_name {
  join: view_name_2 {
    view_label: "View Label I Want"
  }
}

Hierarchy

view_label

Default Value

The name of the join

Accepts

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. You can use view_label to group that view’s fields under the name of a different view:

You can use view_label when you need more than one view for modeling purposes, but those views represent the same entity to your business users. In the example above, you have an Explore called order_items with two joined views: order_facts and orders. You may want those views to retain separate names for modeling purposes. However, it might make things simpler for your users if they both appear as Orders in the UI.

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 { 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 { 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 { 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

view_label Affects the Explore’s Joined Views

This parameter is similar to view_label (for Explores) but affects the Explore’s joined views instead of the base view. Unlike label (for views), this parameter only affects the view when displayed in that Explore.

Top