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 theview_label
(for Explores) parameter documentation page.
view_label
can also be used as part of a dimension, measure, or filter, described on theview_label
(for fields) parameter documentation page.
Usage
explore: view_name { join: view_name_2 { view_label: "desired label" } }
Hierarchy
view_label |
Default Value
The name of the join
Accepts
A string
|
Definition
view_label
changes the way that a group of fields from a joined view are labeled in the field picker. You can use view_label
to group a 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. For example, consider 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.
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, make sure that the capitalization used in view_label
is correct. The capitalization should match how the view name appears in the field picker. For example:
explore: product_info {
join: product_facts {
view_label: "Product Info"
sql_on: ${product_info.product_id} = ${product_facts.product_id} ;;
}
}
product_info
will appear in the field picker as 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 relabel a joined view
LookML has several ways to rename 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.
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.