Value variables - min and max

We’ve just looked at variables that stored uid results from query blocks. Value variables store the values against which they match.

Value variables work differently to query variables. Value variables are context dependent - in fact, they are a map from UID to value and we can exploit this when reading and filtering value variables. The value from a value variable is extracted with val(<variable-name>).

At the point of definition, because the context is within the appropriate UID, value variables act like the corresponding value. In the enclosing block, value variables are the UID to value map and must be aggregated.

Aggregations over value variables aren’t dependent on an index - there’s no need for indexing, the values have already been found in the query.

min and max can be applied to int, float, string, bool, and date types.

Endpoint: /query