I have a repeating group which shows all available products, I want to create a short function which should
A. Display products with highest rating first (rating ranges from 1 to 5)
B. Display products with price lowest or highest first
How do you want to achieve those behaviors, by having three buttons, something like filters?
My propose is to create a new state which will contain the needed data. Let’s say this state will be called PRODUCTS. Then in RG, in Data source put state PRODUCTS
Button for getting highest ranking product: Set state PRODUCTS → value: Do a search for products and just sort by rating variable - descending YES.
Button for getting display products with lowest/highest price: Set state PRODUCTS → value: Do a search for products sort by price descending NO/YES