Budibase / budibase

Low code platform for building business apps and workflows in minutes. Supports PostgreSQL, MySQL, MariaDB, MSSQL, MongoDB, Rest API, Docker, K8s, and more 🚀
https://budibase.com
Other
22.56k stars 1.56k forks source link

Repeater block filtering does not appear to function properly when a filter is bound to Current User.email #14477

Open cerealcoder opened 2 months ago

cerealcoder commented 2 months ago

Hosting

Describe the bug My goal is to use a filter in a repeater block to select rows from a column for which the current user is "authorized". In this case, authorization is achieved by adding the current user's email address to a column in a data table. The filter works correctly when, at design time, I specify a literal value. But when I change the literal value to a binding (the current user's email address), the filter returns an empty data set.

To Reproduce

  1. Create a data table that contains a column of type Multi user
  2. Populate a row in the data table with the current user's email address (using the value provided by the cloud IDE)
  3. In a screen, create a data provider that references the table
  4. In the data provider, create a repeater block
  5. In the repeater block, enable filtering
  6. Add a filter line item such that (a) the column references the Multi user column, (b) the option is Contains, (c) the option is Binding, and (d) the value is {{ Current User.email }}
  7. Preview the screen
  8. Verify that the repeater block renders the Empty text string (this is not expected)
  9. Modify the filter such that (a) the option is Value, and (b) the value is a literal string that matches the current user's email address (via a picker provided by the cloud IDE)
  10. Preview the screen
  11. Verify the repeater block renders the appropriate content (this is expected, but using a literal value is not acceptable)

Expected behavior The filter should be able to utilize Current user.email instead of a literal value.

App Export stardustadmin-export-1724966474225.tar.gz

Desktop (please complete the following information):

linear[bot] commented 2 months ago

BUDI-8599 Repeater block filtering does not appear to function properly when a filter is bound to Current User.email

aptkingston commented 1 month ago

Hey @cerealcoder. We filter using user IDs rather than emails. You just need to update the binding to use {{ Current User._id }} instead, and it'll work as expected.

On another note, you don't need to use a data provider with a repeater block. Blocks can fetch data directly, so just update your repeater block to pull data from the table itself instead of from a data provider. This will also enable proper server side filtering (rather than client side, which happens if you use a data provider with a block).