Forum Academy Marketplace Showcase Pricing Features

Get a result for every item of a list

Hi there,
I’ve been stuck on something for a while, I give up, please help me if you know some way to do something like this :
Let’s say I have three Things set up :
Some Products, (soya sauce, carrots, french fries…)
Some Brands (Wallmart, Heinz…)
And some Pairs (ketchup-heinz…) pairing one product with a brand, with a price.
Each brand have a lot of product, and some product belong to multiple brands (not only one brand makes coffee for example)
I have a list of product, and I need to find the list of brands someone has to go and find so he can gather all his products (if he wants some ketchup, some cocoa and some shoes, it should show “Nestle, Heinz, Adidas”) with the constraint that it should show the cheapest brand for that given product…

I’m stuck as I don’t know how to get a list of result for Do a search for for each item in my list of product. My first approach is to use a repeating group containing the products, and in each cell have a group with the data-source set to “Do a search for Pair, constraint : product = Current cell’s product; sort by price : first item’s Brand”
But I can’t use the list of Brands that is generated as every element is in a different cell of the repeating group…

(If it helps, as Pairs contains only one brand, retreiving a list of pair instead of a list of brands doesn’t matter)

Hope it is somehow understable, and thanks for reading :slight_smile:
Have a good day (or night)

Hi @stern.solal

If I understand well your needs, in fact you shouldn’t be looking for products but for pairs (with the product constraint).

What I’d do if I were you is displaying a repeating group populated with Pairs like the following :
Do a search for pairs with constraint Product = This product sorted by price. Then in each cell you can display the brand linked to the current Pair. You can then add the cheapest to, let’s say, the user cart and then do it again for another product in the list.

In the case this should be iterated automatically on the whole user’s list, then you can only do this in the backend by using a “Schedule API workflow on a list” and, for instance, add each result to the user’s basket and finally display the basket (which is obviously a list of pairs and not products).

Hope this will help !

Best,

Arthur