I have a list of restaurants. They can have programs, coupons, deals.
I want to sort this restaurant list with a specific algorithm.
If a restaurant have a coupon they get 1 point, if they have program 1 point and if they have deals they get 1 point. I want to sort the list of restaurant so: biggest scores to lowest scores. I want to honor restaurants who have active in marketing and reward them with higher rankings in the list because they are interessanter for the app users than the others, who don’t offer anything to the app community.
Please let me know how to solve this specific sorting problem with Adalo. Thank you!
Leslie
Unfortunately Adalo doesn’t support dynamic sort in the list. In other words, you need to use a certain property in the collection to sort records.
For your particular case I would explore the option of adding the “rank” property to Restaurants collection, and storing the rank value (number) there. This property could be used as a sort criteria.
Another question is how to calculate “rank”. Maybe you can update it when creating / updating a restaurant itself. E.g. you have something like “edit restaurant” page, where owner sets up all the parameters. When pressing “save”, rank is calculated based on some formula you choose. This will work if a ranking is “static”, e.g. it depends on promo qty, coupons qty, menu size, etc.
You can even try to make it work together with “user rating” (have 3 fields: user rating, rank and final rating, and update final rating based on a formula each time either user rating or rank is changed).
I just can’t do that. Problem: I have multiple collections.
Restaurants (here is a property called Qscore, which I want to sort)
Coupons
Deals
Programs
So if I create a new coupon or deal or program that number will be saved into that collection. How could I calculate data in different collections nad save the calculated QScore into the restaurant’s QScore property?
If a coupon, deal, program added to the collection, in the restaurant’s Qscore property should change the number value.
That is the million dollar question. Have an Idea, where to look for, or in this case with Adalo I just can’t do that right now? Thanks again your insights.
Leslie
As an example. Your “Coupon” table should have a relationship to “Restaurants” (so that one Restaurant can have many Coupons).
Let’s imagine that each Coupon should increase QScore by one. Then here is what you can do:
Have a page to create a new Coupon. There should be current Restaurant in this page (or you should have a dropdown for selecting the restaurant)
On the “Create Coupon” button, you add an action to Create new Coupon
Then you add a second action, to update Current Restaurant, then in the Qscore field you add: Current Restaurant → Qscore + 1.