Number of people who have bookmarked an establishment

Hello everyone, I have a small, very small question.

I have created an app that lists the bars in my city, users can bookmark these bars to see in another view their events and news.

Is it possible to retrieve the number of users who have bookmarked this bar?

Thanks in advance :slight_smile:
Thomas

Yes, probably. It depends on how these “bookmarks” are being saved. What type of columns are they being saved to?

If they are user specific columns, then the answer is no.

Otherwise, yes it’s possible and the method will depend on the type of column and how your tables are structured. But ultimately, you will need a rollup column.

1 Like

I’m just using the native favorites function, so it’s actually a specific column :frowning:
Sad news !

I will look into changing the system!

Have a read of the below - very similar use case as yours…

What you will probably need to do is implement your own “Like” function, with 2 columns in your Establishments table:

  • A user specific boolean column to hold each users “Like”
  • A number column to use as a global counter for the number of likes for each establishment

You’ll need to use a component that you can attach an action to (similar to how I described in the above), and when a user “Likes” an establishment, your action should do two things:

  • Set the user specific column to true
  • Increment the counter by 1

You might want to implement additional logic to prevent users from “liking” an establishment multiple times and blowing out the counter.

Ah, thank you, I will check this post !