Repeating an item on condition ( if quantity not equal to zero )

Hi there,

In the context of a tutorial for a Wine Shop app I have a container that repeats itself,

and I would like to display only the wines which quantities are not equal to zero.

I tried to edit edit the biding

with a formula but I’ve no idea what are the ‘IF’ arguments

I also tried to define a new collection with the condition quantity!=0 by modifying it’s logic, without success.

I’m stuck, any idea how to do this? :pray:

Use formula binding:

SELECT(data.Wine_collection, item.Quantity>0)

Select goes through all of the records of the “Wine_collection” and checks the property of ‘Quantity’ for each of them. If the value is more than 0 the record is included in the output of this formula.


It worked well thx. I first wrote “data.Wine_collection[0]” instead of “item” and it didn’t work.

Yeah, well. That is a common mistake. In order to avoid such sort of issues in the future You might want to remember this.

When You have nested formulas, so MAP(SELECT()) or any other combination that has “lists” as inputs I do suggest using different aliases on the formulas. For example in the above case: MAP<fullList>(Select())
That can help to refer to different lists and objects inside the formulas.

Cheers and good luck with Your project.

:pray: Thank you very much for the piece of advice. I’m going to try that and I’ll give a feedback here ( still climbing the learning curve one step after the other )

Oh, and about the learning curve. Please visit the documentation frequently. It is a pretty good resource.

Yeah actually I always search in the documentation before posting here. It really is a great work - but not always practical for a beginner. I bet the needed information is in there but actually finding it is not always straightforward.