This page refers to the
view_label
parameter that is part of an Explore.
view_label
can also be used as part of a join, described on theview_label
(for joins) 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: explore_name { view_label: "desired label for the view" }
Hierarchy
view_label |
Default Value
The name of the Explore
Accepts
A string
|
Definition
view_label
changes the way that the group of fields from an Explore's base view will be labeled in the field picker.
Sometimes view_label
is used to add an underscore in front of the view name so that it sorts alphabetically to be the top view in the field picker. Alternatively, you can use it when you need more than one view for modeling purposes, but the views represent the same entity as far as business users are concerned. For example, you might have one view defined in your LookML as customer
and another as customer_facts
, 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 want to change the names of the fields themselves, you can use the label
parameter.
Examples
Make the customer_facts
Explore appear to business users to be part of the Customers view:
explore: customer_facts {
view_label: "Customers"
}
Make the product_facts
Explore appear to users to be part of the Product Info view:
explore: product_facts {
view_label: "Product Info"
}
Common challenges
view_label
has no effect other than changing the field picker appearance
When you change the view_label
of an Explore, only the field picker is affected. The way that the Explore appears in the Explore menu, and the way that fields should be referenced in the LookML, are both unchanged.
Use proper capitalization when combining multiple views via view_label
If you want the fields from the Explore's base view to be merged with one of the Explore's joined views 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 {
view_label: "Product Info"
join: product_info {
sql_on: ${product.product_id} = ${product_info.product_id} ;;
}
}
The way that product_info
will appear in the field picker is Product Info; each word is capitalized, and underscores are changed to spaces. For this reason, we used view_label: 'Product Info'
instead of view_label: 'product_info'
.
A field's view_label
takes precedence over an Explore's view_label
If a field in an Explore has a view_label
, the field will appear under its view_label
, not the Explore's view_label
. Consider this example, where both an Explore and a dimension have view_label
values. The ID dimension will appear under the "View Label on Field" view_label
, not the "View Label on Explore" view_label
.
explore: distribution_centers {
view_label: "View Label on Explore"
group_label: "theLook"
}
dimension: id {
view_label: "View Label on Field"
type: number
primary_key: yes
sql: ${TABLE}.id;;
}
Things to know
view_label
affects the Explore's base view
This parameter is similar to view_label
(for joins) but affects the Explore's base view instead of the joined views. Unlike label
(for views), this parameter only affects the base view in that Explore.