every-whose in key value list?

Given this:

set theSizeList to {{theSize:"cXS", quantity:0}, {theSize:"cS", quantity:36}, {theSize:"cM", quantity:65}, {theSize:"cL", quantity:76}, {theSize:"cXL", quantity:40}, {theSize:"cXXL", quantity:20}, {theSize:"cXXXL", quantity:7}, {theSize:"cXXXXL", quantity:1}}

How do I return a list of every size whose quantity is not 0?

This doesn’t work:


every item of theSizeCells whose (quantity of it ≠ "0")
-->	"Can't get {{theSize:\"cXS\", quantity:0}, {theSize:\"cS\", quantity:36}, {theSize:\"cM\", quantity:65}, {theSize:\"cL\", quantity:76}, {theSize:\"cXL\", quantity:40}, {theSize:\"cXXL\", quantity:20}, {theSize:\"cXXXL\", quantity:7}, {theSize:\"cXXXXL\", quantity:1}} whose quantity ≠ 0."

Still a little shaky with this key value business.

Oops, I gave the variable two different names in that last scriptlet I posted.
But it still doesn’t work.

Hi,

the whose filter doesn’t work in lists at all, it works only in elements (or properties) of an application
You have to do it the conventional way


set theSizeList to {{theSize:"cXS", quantity:0}, {theSize:"cS", quantity:36}, {theSize:"cM", quantity:65}, {theSize:"cL", quantity:76}, {theSize:"cXL", quantity:40}, {theSize:"cXXL", quantity:20}, {theSize:"cXXXL", quantity:7}, {theSize:"cXXXXL", quantity:1}}

set quantityZero to {}
repeat with i in theSizeList
	if quantity of i is 0 then set end of quantityZero to contents of i
end repeat

thanks!