How to get a number of reviews and average ratings of products

Hello everyone,

I am new to bubble :blush:

I would like to show the number of reviews and average ratings for each product like dashboard. Could anyone let me know how to implement this?

My tables are as below…

Simply there are 3 tables - Products, Reviews and Ratings

Products table

  • name
  • created date

Reviews table

  • content
  • creator
  • product (points to Product)
  • created date

Ratings table

  • number
  • creator
  • product (points to Product)
  • created date

Ratings table is unnecessary.

Do a search for Reviews constrain by the Product field then you will have all reviews for the Product.

Add to the Reviews table a field for Rating that is of type number.

Then when you want to show the total number of reviews just use the :count operator after your search for Reviews. And when want to show the average rating reference the search for reviews each items Rating then the :average operator.

2 Likes

I appreciate for your solution!! it’s exactly what I wanted! And you are right - no need for Ratings table :sweat_smile: Thank you again!

Thank you :blush:

1 Like