Are you using our SaaS platform (Baserow.io) or self-hosting Baserow?
SaaS
What are the exact steps to reproduce this issue?
Hello Baserow Community,
I’ve been working extensively with the Baserow API and encountered a challenge when filtering rows based on single-select fields. Currently, the single_select_equal filter requires the use of option IDs instead of their value names. This creates a significant issue for workflows where single-select option IDs are frequently updated or changed.
Is there a way to filter rows directly by the single-select value names instead of their IDs? If not, are there plans to support this functionality in future updates? * It would eliminate the need for additional API calls or caching mechanisms to manage changing IDs.
To reproduce the issue, create a single-select field, populate rows with its values, then attempt to filter rows via the API using value names instead of IDs, which will fail because the API requires IDs for filtering.
My request: https://api.baserow.io/api/database/rows/table/{{tableid}}/?user_field_names=true&filters={"filter_type":"AND","filters":[{"field":"Project Manager","type":"contains","value":"Sarah Johnson"}]}
Thanks for your reply, @cwinhall. I actually tried using the same filter query before and encountered an issue. When you have values like Sarah Johnson and Sarah Johnson Etc, it returns two records. However, I only need the exact match for Sarah Johnson, which should return just one result.
The single_select_equal filter indeed requires the id of the single select item. There are no plans to change this in the near future.
I see 2 potential work arounds of this:
Replace the single select field with a link to table field and store the project managers in a separate table. This allows you to work with the link_row_has filter. This will still require an id, but since the project managers are stored in a separate table, it might be less likely that the id’s change over time.
Add a formula field to your table with the formula totext(field('Project Manager')). This converts the single select value to a single text value and allows you to use the equal filter that checks for an exact text. This allows you to distinct the value Sarah Johnson from Sarah Jonson Etc.
I guess that the second workaround is the most likely solution for you. You can hide the formula field from the end user and it automatically updates when you update the single select field.