Using expressions to adjust quota counts
In addition to specifying numeric values for the Target and Completed attributes in the XML/JSON in PATCH requests, you can use an mrEvaluate compatible expression that is evaluated for each quota. The valid identifiers in the expression are “Target”, “Completed”, and “Pending”. The new values are calculated for each count before they are updated, that is, the expressions are always based on the current counts before any updates are applied. The expressions are specified by using TargetExpression, CompletedExpression, and PendingExpression attributes to enable the Target, Completed, and Pending attributes to be retained as integers in the XML schema.
Expressions can be used to implement a rule such as “reset completes to zero and adjust the targets taking into account the number of current completes”. To achieve this for the MM1WithQuota project, the following request body would be sent as a PATCH request to the URL /Quota/Projects/MM1WithQuota/Quotas.
XML
<Quotas TargetExpression="50 + (50 – Completed)" Completed="0"/>
JSON
{
"TargetExpression": "50 + (50 – Completed)",
"Completed": 0
}