Skip to content

Quantifier Operators

Quantifier operators let you inspect array values and counts without iterating manually.

Use any to check if at least one element in an array satisfies a condition:

any __tags__ of **Article** is equal to "featured"

Interactive Example

Policy Rule
Test Data (JSON)

any over an empty array always returns false.

Use all to check that every element in an array satisfies a condition:

all __scores__ of **Test** is greater than 50

Interactive Example

Policy Rule
Test Data (JSON)

all over an empty array always returns true.

Use the number of to count the elements in an array and compare against a value:

the number of __items__ of **Cart** is greater than 0

Interactive Example

Policy Rule
Test Data (JSON)

You can use number of without the article the:

number of __errors__ of **Report** is equal to 0

Use the length of to get the character count of a string (or element count of an array) and compare it:

the length of __username__ of **User** is greater than 3

Interactive Example

Policy Rule
Test Data (JSON)

Works on arrays too — returns the array length:

Interactive Example

Policy Rule
Test Data (JSON)

Use the sum of to add up all numeric values in an array:

the sum of __prices__ of **Order** is greater than 100

Interactive Example

Policy Rule
Test Data (JSON)

Use the average of (or avg of / mean of) to calculate the mean of numeric values:

the average of __scores__ of **Student** is at least 70

Interactive Example

Policy Rule
Test Data (JSON)

Use the min of (or minimum of / smallest of) to find the smallest value in an array:

the min of __bids__ of **Auction** is greater than 10

Interactive Example

Policy Rule
Test Data (JSON)

Use the max of (or maximum of / largest of) to find the largest value in an array:

the max of __temperatures__ of **Report** is less than 100

Interactive Example

Policy Rule
Test Data (JSON)

When array elements are objects, you can check multiple properties of each element using where (or satisfies):

any __items__ of **Order**
where (its __status__ is equal to "shipped"
and its __quantity__ is greater than 0)

Each sub-condition starts with its to reference the current element. See Compound Predicates for full details.

any and all can iterate over arrays produced by dynamic key lookups:

any __user__ of **request** looked up in **user_roles** looked up in **role_grants**
where (its __action__ is equal to the __action__ of the **request**)

This resolves a chain of data lookups before iterating. See Platform RBAC for the current platform access model.

OperatorWhat it checks
any __prop__ of **Obj** ...At least one array element matches
all __prop__ of **Obj** ...Every array element matches
any ... where (its __x__ op val and ...)Element matches compound condition
any ... looked up in **Target** ...Iterate over dynamically resolved array
the number of __prop__ of **Obj** ...Count of array elements
the length of __prop__ of **Obj** ...Character length (string) or element count (array)
the sum of __prop__ of **Obj** ...Sum of numeric array elements
the average of __prop__ of **Obj** ...Mean of numeric array elements
the min of __prop__ of **Obj** ...Smallest numeric array element
the max of __prop__ of **Obj** ...Largest numeric array element