Represents a filter control for a Lotus dashboard.
Dashboard filters are input controls displayed at the top of a dashboard that allow users to filter data across multiple cards. Each filter can be mapped to one or more query variables in the dashboard's cards.
Filter Types
:text- Free-form text input:number- Numeric input:date- Single date selection:date_range- Date range selection (start/end):select- Dropdown selection
Widgets
:input- Standard text/number input field:select- Dropdown select:date_picker- Date picker calendar:date_range_picker- Date range picker with start/end
The config field stores widget-specific configuration like select options,
date formats, or validation rules.
Relative Date Tokens
The default_value of a :date_range filter can be a relative date token
such as "last_30_days", and the default_value of a :date filter can be
"today" or "yesterday". The token resolves each time a card runs, see
Lotus.Dashboards.DateToken. The changeset does not accept a range token as
the default_value of a :date filter.
Cascading Filters
A filter with the :select widget can get its options from a saved query in
source_query_id. With depends_on_filter_id, the value of that other filter
of the same dashboard goes to the source query as the variable named after
the other filter's name. A city filter that depends on a country filter
can use SELECT DISTINCT city FROM locations WHERE country = {{country}}.
See Lotus.Dashboards.list_dashboard_filter_options/2.
A dependency needs a source query and cannot be the filter itself.
Lotus.Dashboards also rejects a dependency on a filter of another dashboard
and a dependency that makes a cycle. A delete of the source query or of the
other filter sets the field to nil.
Summary
Types
@type t() :: %Lotus.Storage.DashboardFilter{ __meta__: term(), card_mappings: [Lotus.Storage.DashboardCardFilterMapping.t()] | Ecto.Association.NotLoaded.t(), config: map(), dashboard: Lotus.Storage.Dashboard.t() | Ecto.Association.NotLoaded.t(), dashboard_id: term(), default_value: String.t() | nil, dependent_filters: [t()] | Ecto.Association.NotLoaded.t(), depends_on_filter: t() | Ecto.Association.NotLoaded.t() | nil, depends_on_filter_id: term() | nil, filter_type: :text | :number | :date | :date_range | :select, id: term(), inserted_at: DateTime.t(), label: String.t(), name: String.t(), position: non_neg_integer(), source_query: Lotus.Storage.Query.t() | Ecto.Association.NotLoaded.t() | nil, source_query_id: term() | nil, updated_at: DateTime.t(), widget: :input | :select | :date_picker | :date_range_picker }