本頁面會連結至定義欄位的所有 LookML 參數。
欄位分為以下幾種類型:
- 「維度」代表資料表中的資料欄,或是根據某種資料欄操作或組合計算出的值
- 維度群組僅適用於時間資料,可讓您一次建立多個時間維度
- 測量指標類似於 SQL 中的匯總函式 (例如
COUNT、SUM、AVG),代表多個資料列的相關資訊 - 篩選器會建立僅限篩選器的欄位,使用者可透過該欄位為範本化篩選器或條件式彙整提供輸入內容
- 參數會建立篩選器限定欄位,使用者可透過該欄位為 Liquid
{% parameter %}標記提供輸入內容
應用實例
將游標懸停在參數名稱上,即可查看簡短說明。按一下參數名稱,即可跳到參考資料頁面。
如果參數可設為多個特定選項之一,則預設值會列在最前面。
## STRUCTURAL PARAMETERS view: view_name { (dimension |dimension_group |measure |filter | parameter):field_name{ intervals: [interval, interval, …] timeframes: [timeframe, timeframe, …] # ACTION AND LINKING PARAMETERS action: { label: "Label to Appear in Action Menu" url: "url" icon_url: "url" form_url: "url" param: { name: "name string" value: "value string" } # Possibly more param definitions form_param: { name: "title" type: select | string | textarea label: "desired label name" required: yes | no default: "value string" option: { name: "name string" value: "value string" } # Possibly more option definitions } # Possibly more form_param definitions } drill_fields: [field_or_set, field_or_set, ...] tags: ["string1", "string2", ...] link: { label: "desired label name;" url: "desired_url" icon_url: "url_of_an_image_file" } # Possibly more link definitions # DISPLAY PARAMETERS alias: [old_field_name, old_field_name, ...] alpha_sort: yes | no description: "description string" group_label: "desired group label name" group_item_label: "label to use under the group label in the field picker" hidden: yes | no label: "desired label name" label_from_parameter: parameter_name order_by_field: dimension_name | dimension_group_name | measure_name style: classic | interval | integer | relational view_label: "desired label name" # FILTER PARAMETERS can_filter: yes | no case_sensitive: yes | no filters: [dimension: "filter expression", dimension: "filter expression", ...] skip_drill_filter: yes | no # FILTER SUGGESTION PARAMETERS allowed_value: { label: "desired label name" value: "looker filter expression" } # Possibly more allowed_value definitions bypass_suggest_restrictions: yes | no full_suggestions: yes | no suggest_dimension: dimension_name suggest_explore: explore_name suggest_persist_for: "N (seconds | minutes | hours)" suggestable: yes | no suggestions: ["suggestion string", "suggestion string", "…"]< # QUERY PARAMETERS allow_approximate_optimization: yes | no approximate: yes | no approximate_threshold: N convert_tz: yes | no datatype: epoch | timestamp | datetime | date | yyyymmdd fanout_on: repeated_record_name precision: N primary_key: yes | no required_access_grants: [access_grant_name, access_grant_name, ...] required_fields: [field_name, field_name, ...] sql_distinct_key: SQL expression to define repeated entities ;; # VALUE AND FORMATTING PARAMETERS case: { when: { sql: SQL condition ;; label: "value" } # Possibly more when statements } default_value: "desired default value" direction: "row | column" end_location_field: dimension_name html: HTML expression using Liquid template elements ;; list_field: dimension_name percentile: Nth percentile sql: SQL expression to generate the field value ;; sql_end: SQL expression indicating the end time of a duration ;; sql_latitude: SQL expression to generate a latitude ;; sql_longitude: SQL expression to generate a longitude ;; sql_start: SQL expression indicating the start time of a duration ;; start_location_field: dimension_name synonyms: [synonym1, synonym2, ...] tiers: [N, N, ...] type: dimension_field_type # For a dimension field type: dimension_group_type # For a dimension_group field type: measure_field_type # For a measure field type: filter_field_type # For a filter field type: parameter_field_type # For a parameter field string_datatype: unicode # For a dimension field units: feet | kilometers | meters | miles | nautical_miles | yards value_format: "excel-style formatting string" value_format_name: format_name # VISUALIZATION PARAMETERS allow_fill: yes | no map_layer_name: name_of_map_layer } }
參數定義
- D = 維度
- DG = 維度群組
- M = 評估
- F = 篩選
- P = 參數
| 參數名稱 | 有效的欄位類型 | 說明 |
|---|---|---|
| 結構參數 | ||
dimension
|
D | 建立維度欄位 |
dimension_group
|
DG | 同時建立多個時間維度 |
filter
|
F | 建立篩選器限定欄位,用於範本化篩選器或條件式彙整 |
measure
|
M | 建立測量指標欄位 |
parameter
|
P | 建立僅限篩選器的欄位,使用者可透過這個欄位為 Liquid {% parameter %} 標記提供輸入內容 |
intervals
|
DG | 定義 type: duration 的 dimension_group 中所需的時間長度維度組合 |
timeframes
|
DG | 定義 type: time 的 dimension_group 中所需的時間範圍維度組合 |
| 動作和連結參數 | ||
action
|
D M | 在欄位上建立資料動作,讓使用者直接透過 Looker 跨工具執行工作 |
drill_fields
|
D DG M | 宣告深入分析測量指標或維度時,要顯示的欄位清單 |
link
|
D M | 建立其他 Looker 和外部內容的連結 |
tags
|
D DG M F P | 新增可傳遞至其他應用程式的文字,提供欄位相關資料 |
| 顯示參數 | ||
alias
|
D DG M F P | 允許使用舊欄位名稱的已儲存網址在欄位重新命名後繼續運作 |
alpha_sort
|
D | 讓 case 參數按照字母順序排序條件
|
description
|
D DG M F P | 為欄位新增說明,使用者將游標懸停在欄位上時即可看到。 |
group_label
|
D DG M F | 在欄位挑選器中,將檢視表內的欄位分組 |
group_item_label
|
D DG M F | 指定欄位挑選器中,欄位群組標籤下方的欄位標籤 |
hidden
|
D DG M F P | 在「探索」使用者介面中隱藏欄位 |
label
|
D DG M F P | 變更欄位名稱在欄位挑選器中的顯示方式 |
label_from_parameter
|
D M | 根據 parameter 的輸入內容,變更圖表中欄位名稱的顯示方式 |
order_by_field
|
D DG M | 依另一個欄位的值排序欄位 支援維度、維度群組 支援的測量指標 |
style
|
D | 變更層級在 Looker UI 中顯示 type: tier 維度的方式 |
view_label
|
D DG M F P | 變更欄位挑選器中檢視畫面內顯示的欄位 |
| 篩選器參數 | ||
can_filter
|
D DG M | 決定維度或測量指標是否能做為篩選器 |
case_sensitive
|
D F | 決定維度的篩選器是否區分大小寫 |
filter
|
F | 建立篩選器限定欄位,用於範本化篩選器 |
filters
|
M | 根據維度限制,限制測量指標的計算 |
skip_drill_filter
|
D | 在深入分析測量指標時,防止將維度新增至篩選條件 |
| 篩選建議參數 | ||
allowed_value
|
P | 指定 parameter 的選項 |
bypass_suggest_restrictions
|
D DG F P | 使用 sql_always_where 時,向使用者顯示建議,但不將這些限制套用至建議 |
full_suggestions
|
D DG F P | 控制 Looker 如何查詢資料庫,為探索篩選器中的欄位值提供建議。Looker 可以使用基本的 SELECT DISTINCT 查詢,也可以使用探索的完整邏輯,包括彙整和 sql_always_where 與 access_filter 參數。 |
suggest_dimension
|
D DG M F P | 根據不同維度的值,為欄位提供建議 |
suggest_explore
|
D DG M F P | 根據其他探索的值,為欄位提供建議 |
suggest_persist_for
|
D F P | 變更 Looker 篩選器建議的快取設定 |
suggestable
|
D DG M F P | 啟用或停用欄位建議 |
suggestions
|
D F P | 宣告要用於欄位建議的值清單 |
| 查詢參數 | ||
allow_approximate_optimization |
M | 允許 type: count 或 type: count_distinct 測量指標的不重複計數近似值,以便將測量指標用於匯總感知 |
approximate |
M | 對 type: count_distinct 的測量指標執行約略計數。如需支援這個參數的方言清單,請參閱 approximate 說明文件頁面。 |
approximate_threshold
|
M | 設定 BigQuery 從精確不重複計數切換至近似不重複計數的計數 |
convert_tz
|
D DG M F P | 停用欄位的自動時區轉換功能 |
datatype
|
D DG F M | 指定您為欄位提供的時間資料類型 |
fanout_on
|
D DG M | 啟用 Google BigQuery 重複欄位的存取權 |
precision
|
M | 指定計算 Looker 對稱式匯總函式時,要使用的小數位數 |
primary_key
|
D | 將維度宣告為檢視表的主鍵 |
required_access_grants |
D DG F M P | 限制只有使用者屬性值與存取權授予相符的使用者,才能存取欄位 |
required_fields
|
D M | 選擇欄位時,必須在查詢中新增其他欄位 |
sql_distinct_key
|
M | 定義不重複實體,用於計算 type: sum_distinct 或 type: average_distinct 的測量結果 |
| 值和格式設定參數 | ||
case
|
D | 建立一組離散值,維度可根據 SQL 條件決定 |
default_value
|
F P | 指定篩選器欄位的預設值 |
direction
|
M | 決定使用透視表時,type: percent_of_total 或 type: running_total 測量值的計算方向 |
end_location_field
|
D | 定義包含 type: distance 欄位終點位置的欄位 |
html
|
D DG M | 使用 Liquid 範本修改欄位的 HTML 輸出內容 |
list_field
|
M | 宣告要用於計算 type: list 測量指標的維度 |
percentile
|
M | 指定 type: percentile 或 type: percentile_distinct 測量指標的分數值 (第 N 個百分位數) |
sql
|
D DG M F | 決定欄位的計算方式 |
sql_end
|
D DG | 定義時間長度類型維度群組或時間長度類型維度的時間長度結束時間 |
sql_latitude
|
D | 定義 type: location 維度的緯度 |
sql_longitude
|
D | 定義 type: location 維度的經度 |
sql_start
|
D DG | 定義時間長度類型維度群組或時間長度類型維度的時間長度開始時間 |
start_location_field
|
D | 定義包含 type: distance 欄位起始位置的欄位 |
synonyms
|
D DG F M P | 指定字串同義詞 (字詞或詞組) 清單,協助大型語言模型和應用程式開發人員瞭解使用者可能用來指稱欄位的其他方式 |
tiers
|
D | 定義 type: tier 維度的層級 |
type (適用於維度、篩選器或參數)
|
D F P | 指定維度、篩選器或參數的類型 |
type (適用於維度群組)
|
DG | 指定維度群組的類型 |
type (用於測量)
|
M | 指定測量類型 |
string_datatype
|
D | 指定 SQL Server 或 MySQL 的 type: string 欄位 Unicode 資料類型 |
units
|
D | 指定 type: distance 欄位使用的單位 |
value_format
|
D M | 使用 Excel 樣式選項設定欄位輸出內容的格式 |
value_format_name
|
D M | 使用內建或自訂格式設定欄位輸出內容 |
| 視覺化參數 | ||
allow_fill
|
D DG | 決定是否允許填補維度 |
map_layer_name
|
D | 指定資料值與地理區域的對應關係,該區域是您在內建或自訂地圖上定義 |
| 應避免的參數 | ||
decimals
|
D M |
已移除 5.4
替換為 value_format
|
format
|
D M |
3.16 版已移除
替換為 value_format |