bindingInfo.setFormula(measure1, formula, [measure2])

Sets the aggregation formula for one of the measures specified by bindingInfo.measureFields. This is equivalent to setting the ‘Aggregate’ method for a measure in the Crosstab Editor.

bindingInfoSetFormula

Parameters

measure1

String: Name of a measure to aggregate

formula

A Style Constant object. See Summarization Formula.

measure2

String: Name of the secondary measure for bivariate aggregation formulas (e.g., correlation)

Example

Crosstab1.query = 'Sales';
Crosstab1.bindingInfo.rowFields = ['Category','Name'];
Crosstab1.bindingInfo.colFields = ['Region','State'];
Crosstab1.bindingInfo.measureFields = ['Total','Quantity Purchased'];
Crosstab1.bindingInfo.setFormula('Quantity Purchased',StyleConstant.SUM_FORMULA);
Crosstab1.bindingInfo.setFormula('Total',StyleConstant.AVERAGE_FORMULA);

Either syntax below can be used in component script:

bindingInfo.setFormula             // unqualified
Crosstab1.bindingInfo.setFormula   // qualified

For onInit/onRefresh scripts, and for component and property scripts on other components, the second (qualified) form is required.