This page refers to the
suggestions
parameter that is part of a dimension or filter field.You can also use
suggestions
as part of a view, as described on thesuggestions
(for views) parameter documentation page.
Usage
view: view_name { dimension: field_name { suggestions: ["suggestion string", "suggestion string", "…"] } }
Hierarchy
suggestions |
Possible Field Types
Dimension, Filter, Parameter
Accepts
A string or a list of strings
|
Definition
This parameter lets you hard-code the list of suggested values for a filter
field or a dimension
of type: string
that will appear when someone uses that field to filter a query.
Looker typically generates these suggestions by executing the following query on the filter field:
SELECT DISTINCT field_name FROM table
WHERE (field_name LIKE '%' OR field_name LIKE '% %')
GROUP BY 1 ORDER BY 1 LIMIT 1000
Although Looker caches up to 1,000 results for this query, only the first 100 results display to the user as filter suggestions.
If the field is in a large table, this query can be too slow or create too large a database load. By using suggestions
you can hard-code a list of possible values instead and improve performance.
This parameter is also useful if you do not want certain values from a field to appear as suggestions, by specifying a more limited list.
Examples
Replace the default suggestions for the colors
dimension with a hard-coded list:
dimension: colors {
type: string
sql: ${TABLE}.colors ;;
suggestions: ["red", "yellow", "blue"]
}