Add "$compute" query option allowing additional computed properties to be added to each instance. The syntax is similar to the compute() transformation in Data Aggregation, i.e. $compute=<list of compute expressions>, but without the restriction to simple values: allowed compute expressions are any expressions valid in a $filter system query option on the input set.
More formally:
compute = '$compute' EQ computeItem *( COMMA computeItem )
computeItem = commonExpr RWS 'as' RWS computedProperty
computedProperty = odataIdentifier
$compute is also allowed as query option nested within $expand to add computed dynamic properties to expanded entities.
$compute is logically evaluated first, so the computed dynamic properties can be used in $expand, $filter, $orderby, and $select.
Computed structural properties SHOULD be added to the default selection (in absence of $select), and are treated as other dynamic properties:
- $select=* includes computed structural properties
- $expand=* includes computed navigation properties or computed entities/collections of entities
- appear in context URL same way as other (dynamic) properties
GET ~Customers?$expand=Orders($compute=price*qty as totalprice;$select=name,price,qty,totalprice)
Note: in this example, totalprice is available outside of the expand as Orders/totalprice, as in:
GET ~Customers?$filter=Orders/any(o:o/totalprice gt 100)&$expand=Orders($compute=price*qty as totalprice;$select=name,price,qty,totalprice)