Filtering repeating group searches using foreign key's attributes

Hi everyone,

I’m facing an issue while trying to add a constraint in a Do a search for query in Bubble. Here’s the setup:

  • I have a Check-In table with a field called sub_habit_fk, which is a link to the Sub-Habit table.
  • The Sub-Habit table has a status field (Yes/No).
  • I want to add a constraint in my repeating group that only fetches Check-In entries where the related Sub-Habit has status = yes.

Currently, I have a repeating group where the data source is Do a search for Check-In. I’ve already set up some basic constraints like user = Current User and time period = Morning, but I’m struggling to add a constraint for the Sub-Habit's status.

I tried selecting sub_habit_fk in the constraints section, but it only gives me operators like =, is in, etc., and doesn’t allow me to directly access the status field of the related Sub-Habit. When using ‘=’ after the FK field in constraint, I tried different logics, but it gives me an error that it does not accept lists.

Any guidance on how to properly add a constraint where Check-In -> sub_habit_fk -> status is "yes" would be greatly appreciated!

Hi there,

To get that level of filtering, you may need to add a :filtered constraint, and then on that constraint, if you still can’t add what you need with the sub_habit_fk field, you may need to then add :advanced in the :filtered constraint, which will launch yet another popout window. Here you should be able to add just about any level of filtering, but be warned - this usually loads all found records into the browser and filters them locally on the user’s browser, which can slow down performance.

1 Like

I see, I tried it out and it seems to work. About the found records being loaded into the browser locally, apart from the performance issue, it shouldn’t be a privacy issue as long the parent group data source is only fetching that specific user’s data.

Thanks a lot for the help, you really saved a lot of time, and a bunch of workarounds!

1 Like