avg

Gives the average of the numbers of a list or a set, or of one field of its items. Items whose value is not a number are left out. An empty list gives null. A cloud set is averaged on the server.

Runs on: either side: the compiler places the statement that calls it where the values it uses live.

Format:

avg(set_or_list [, field])

Parameters:

Parameter Type Description
set_or_list mixed the set or list
field string  [Optional]the name of the field to average; without it the items themselves are the numbers

Returned Value:

Type Description
number the average, or null

Examples

rating = round(avg(reviews, "stars"), 1)