Hi,
I have an input string array of fruits and quantities as CSV strings e.g. -
{>
“fruits”:[“apple,1”,“banana,2”,“pineapple,3”]
}
I want to make sure that the array always contains at least 5 apples and 2 bananas. I am able to do this with the following feel expressions -
(some item in fruits satisfies (split(item, “,”)[1] = “apple” and number(split(item, “,”)[2]) >= 5)) and (some item in fruits satisfies (split(item, “,”)[1] = “banana” and number(split(item, “,”)[2]) >=2))
I am wondering if this is the right way of doing this predicate or are there better (or more idiomatic) way of doing this.