Hi everyone,
so far I haven’t found a solution for my problem in the forum: I want to build an app, through which people can rate a standardized product at a selected location and then work with the ratings.
Database basics
I have the following database tables:
- products A, B, C, D, E, F, …
- locations 1, 2, 3, 4, 5, 6, …
- location-product-rating (see below)
User workflow
Creating a rating:
The user should be able to go to location X, select a product Y and give it a rating, which is then stored in a database table (location-product-rating):
location |
product |
rating |
1 |
A |
4 |
1 |
A |
3 |
2 |
B |
5 |
2 |
A |
1 |
… and so on
Showing the ratings:
I then want the user base to
a) be able to see all ratings of a product at a given location and furthermore
b) want to show the average product ratings at a given location, only showing the products which have been rated.
Problem
For b) I cannot figure out how to show in a repeating group unique product names per location with the average rating.
For the repeating group data-source I selected “Search for location-product-rating” in order to have all the data. But I can’t figure out how to show just unique product names and the unique product name rating averages.
Can somebody help out?
Thanks for your support on this!
Could you share a link? It might be a bit easier to work with your existing setup on a page.
Hi Gaby,
of course here is the link (does this work for you?): https://bubble.io/page?type=page&name=location-detail&id=product-ratings&tab=tabs-1
The pages are as follows:
- index: create products
- location-index: create locations
- location-detail: rate products per location
In the repeating group on the location-detail page I would like to have the average ratings per product and I cannot get this to work, neither with “Search for …” nor with “Current-cell’s…”.
Does this make sense?
Thanks for your support!
Hey @tilltillio, I got this set up for you on a separate page as your data needed some restructuring (I added new fields, didn’t get rid of your existing ones).
Editor: bubble.is/page?type=page&name=gaby-test&id=product-ratings&tab=tabs-1
Preview: product-ratings.bubbleapps.io/version-test/gaby-test
Why don’t you take a look at that first and let me know if you have any questions. I think it’ll be easier for you to study it first. I added colored borders to all container elements so that you can see exactly how the hierarchy works.
Things to note:
- The source of the repeating group that displays the list of unique products.
- The fact that this repeating group is inside a group set to type Location: this is so that the location-product-rating can be filtered both by the unique product and the location.
Gaby | Coaching Bubble
Hey @romanmg,
thanks for your support on this topic, I finally got it to work after some tweaking an trial and error.
Very much appreciated.
Till