Hi Adalo Fans!
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!
Hi Leslie @Leslie,
Welcome to the forum!
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).
Best regards, Victor.
Thanks for your reply, I try to save the calculated rank number and let you know if I could.
Hi Victor! @Victor
I just can’t do that. Problem: I have multiple collections.
- Restaurants (here is a property called Qscore, which I want to sort)
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.
Is your list in Adalo or an External DB?
Adalo’s database, not external.
Okay I can’t help with this one, Xano can definitelty handle this
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.
I’ve made a quick video showing this: Loom | Free Screen & Video Recording Software | Loom
Again: this approach will work if you need to update the QScore when something is changed by a user (adding new coupon, removing coupon, etc.).
Thank You @Victor!
I forgot the second action after submit to update the Restaurant’s QScore in the database, but now it works fine. Thanks a lot!!