Back
powerSumLens
Grouping and totaling of rows
powerSumLens
Allows formulas in sumLens totals
Default:
When using sumLens, at the end of every group of data, a total is displayed. However you might prefer to display a formula instead of a total. The formula must begin with a '=' to indicate that we are running in PHP mode (so any PHP function or operator can be called).

All fields used in the powerSumLens must be also be included in sumLens. Also the special variable {#} is used to indicate the number of records.

Formula

We want COL3 = total(COL1) / total (COL2)

Then we define:

$lens->sumLens = 'COL1;COL2;COL3';
$lens->powerSumLens = 'COL3^={COL1}/{COL2}';



Calculating Averages

This property is particularly useful for displaying averages.

In the example below, {SalesPercent} is the sum(SalesPercent) for the given group of data. Therefore {SalesPercent}/{#} means:

    (Total SalesPercent) / (no of records) = Average SalesPercent

Syntax
$lens->sumLens = 'SalesPercent';
$lens->powerSumLens = 'SalesPercent^={SalesPercent}/{#}';

 Basic:Yes  Advanced/Enterprise:Yes  DynamicEdit:Yes   [Version 4.0]