How to display data on RG according user's department?

Hi Bubblers,

I have questions that I am stucked with.

I added new fields - department, user_type in the User table.
Then I have create a table called Claims to record all the claims by user which is referencing user by using “Created by”.

In the User table, I have different user_type, let’s say user_type=1 is the approver for the department.

I can use RG to display all the claims.
But I am not sure how I can display the claims according to the approver’s department.

Can anyone help? Thanks!

Hi there, @waichong… if I understand your post correctly, you would need to use an advanced filter to display the appropriate claims to the approver, and the filter would look something like this.

If you haven’t used advanced filters before, be aware that the filtering takes place on the client (browser) side. So, in this case, the search is going to return all of the claims in the database to the browser, and then the filter will be applied. As you can imagine, that could have a negative effect on performance if you have a lot of claims in your database. So, again, just something to keep in mind for now.

Hope this helps.


Thanks @mikeloc ! This works for now.

How can I optimize it?

1 Like

One way you could optimize it is to store the department in a field on the claim. With that field in place, you wouldn’t need to use an advanced filter because a constraint of department = Current User's department would do the trick.

Oh… this is going to create a big flat table?
I was thinking some relationship database will help?

You don’t need to create a big flat table, but you do need to consider how you are going to get at the data you need. In this case, an advanced filter is necessary because there is no direct association between a claim and a user’s department. Advanced filters can be quite powerful, though, and they are best used when you can constrain a search in other ways so as to return as few things as possible to the client.

Thanks! The Advanced filter definitely help on this.

Where can I find the KB for building relational DB in Bubble?

There is a lot of content out there about databases and Bubble, but if you haven’t come across this resource yet, it definitely can’t hurt to check it out.

That is a good reference which I have not seen before.

1 Like

This topic was automatically closed after 70 days. New replies are no longer allowed.