# `Lotus.Storage.DashboardCardFilterMapping`
[🔗](https://github.com/elixir-lotus/lotus/blob/v1.1.0/lib/lotus/storage/dashboard_card_filter_mapping.ex#L1)

Maps a dashboard filter to a query variable within a card.

This schema establishes the connection between a dashboard-level filter and
the query variable it controls within a specific card. When the filter value
changes, it is passed to the query as the specified variable.

## Transform

The optional `transform` field changes the filter value before the query
variable gets it. Lotus has two transforms, for a date range value in the
form `"start,end"`:

- `"date_range_start"` - keeps the part before the comma
- `"date_range_end"` - keeps the part after the comma. A value with no comma
  does not change

Any other transform does not change the value.

The transform gets the value after `Lotus.Dashboards.DateToken` resolves a
relative date token, so a `:date_range` filter with the value
`"last_7_days"` can map its start and end dates to two variables.

Example transform config:
```json
{
  "type": "date_range_start"
}
```

# `t`

```elixir
@type t() :: %Lotus.Storage.DashboardCardFilterMapping{
  __meta__: term(),
  card: Lotus.Storage.DashboardCard.t() | Ecto.Association.NotLoaded.t(),
  card_id: term(),
  filter: Lotus.Storage.DashboardFilter.t() | Ecto.Association.NotLoaded.t(),
  filter_id: term(),
  id: term(),
  inserted_at: DateTime.t(),
  transform: map() | nil,
  updated_at: DateTime.t(),
  variable_name: String.t()
}
```

# `changeset`

# `new`

# `update`

---

*Consult [api-reference.md](api-reference.md) for complete listing*
