Dashboard filter with id and label

Hello

I'm a little bit lost with dashboard filter

I'm running v0.46.2

Is it possible to have a dropdown list with some id as value and a label for the display ?
For instance I want to filter by customer_id and want to display the customer's name

For now I can only do a list with label == value and so I filter with name and not id / ForeignKey. It doesn't look very robust

Also what does "Linked filters" do exactly ? I read the doc Linking filters in dashboards but it doesn't explain how the data is defined / linked ?
How can I defined the link between the filter ?

Hi, if you want to map customer_id to customer_name you can do that from the Admin Settings.

In the Admin Settings > Data Model, you will need to set Customer Name as a foreign key for Customer ID.

And then you can map Customer ID to use Customer Name instead.

For linked filters, have you read the documentation? Sometimes it is explained in a different way than the Learn tutorials :slight_smile:

Take a look and let me know if you still have any questions!

In the Admin Settings > Data Model, you will need to set Customer Name as a foreign key for Customer ID.
And then you can map Customer ID to use Customer Name instead.

I try this

  • edit the field Customer Name
  • set Customer Name as a FK to Customer ID
  • edit to Customer Id > Display values : I only see the option "Use Original Value"
  • edit to Customer Name > Display values > Use Foreign Key > ID
  • in a dashboard, add a filter and link it to a widget on field Customer Id
  • the filter still display Customer Id and no Customer Name

Also if it's only meta-data on table, how can I filter the value available in the dropdown ? for instance i have a deleted_at column and I want to filter out customer that are deleted from the dropdown in dashboard.

Are they a simpler way ? something like I do a query like that

select c.id as key, c.name as label from customer where ...

And in a filter I can select the query and tell the display label and the value to input into linked widget ?

Linked filter

For linked filters, have you read the documentation? Sometimes it is explained in a different way than the Learn tutorials :slight_smile:

Yes i read it too
I don't get how to link filter. In the exemple how the city filter know how to filter city by state ?
Maybe it look for a field state_id in the city table ? what if I have a field state_name without FK instead of state_id in the city table ? or maybe we need to configure meta-data in the admin panel ?
The one button to "link filter" looks like magic.