PivotTable's and PivotMatrix's Map
Mapping fields, headers and data cells
PivotTable::create(array(
...
'map' => array(
'dataField' => function($dataField, $fieldInfo) {
$v = $dataField;
if ($v === 'dollar_sales - sum')
$v = 'Sales (in USD)';
else if ($v === 'dollar_sales - count')
$v = 'Number of Sales';
else if ($v === 'dollar_sales - avg')
$v = 'Sales Average';
return $v;
},
),
...
));
Sales (in USD) | Number of Sales | Sales Average
|
2004
|
2005
|
Total
|
|||||||||||||||||
AV Stores, Co.
|
||||||||||||||||||||
$99,984
|
$35
|
$2,857
|
-
|
-
|
-
|
$99,984
|
$35
|
$2,857
|
||||||||||||
Amica Models & Co.
|
||||||||||||||||||||
$82,223
|
$26
|
$3,162
|
-
|
-
|
-
|
$82,223
|
$26
|
$3,162
|
||||||||||||
Anna's Decorations, Ltd
|
||||||||||||||||||||
-
|
-
|
-
|
$56,932
|
$19
|
$2,996
|
$56,932
|
$19
|
$2,996
|
||||||||||||
Alpha Cognac
|
||||||||||||||||||||
-
|
-
|
-
|
$12,432
|
$5
|
$2,486
|
$12,432
|
$5
|
$2,486
|
||||||||||||
Atelier graphique
|
||||||||||||||||||||
$7,743
|
$3
|
$2,581
|
-
|
-
|
-
|
$7,743
|
$3
|
$2,581
|
||||||||||||
Total
|
$189,950
|
$64
|
$2,968
|
$69,365
|
$24
|
$2,890
|
$259,315
|
$88
|
$2,947
|
PivotTable::create(array(
...
'map' => array(
'dataFieldZone' => function($dataFields) {
return implode("__", $dataFields);
},
),
...
));
dollar_sales - sum - dollar_sales - count - dollar_sales - avg
|
2004
|
2005
|
Total
|
|||||||||||||||||
AV Stores, Co.
|
||||||||||||||||||||
$99,984
|
$35
|
$2,857
|
-
|
-
|
-
|
$99,984
|
$35
|
$2,857
|
||||||||||||
Amica Models & Co.
|
||||||||||||||||||||
$82,223
|
$26
|
$3,162
|
-
|
-
|
-
|
$82,223
|
$26
|
$3,162
|
||||||||||||
Anna's Decorations, Ltd
|
||||||||||||||||||||
-
|
-
|
-
|
$56,932
|
$19
|
$2,996
|
$56,932
|
$19
|
$2,996
|
||||||||||||
Alpha Cognac
|
||||||||||||||||||||
-
|
-
|
-
|
$12,432
|
$5
|
$2,486
|
$12,432
|
$5
|
$2,486
|
||||||||||||
Atelier graphique
|
||||||||||||||||||||
$7,743
|
$3
|
$2,581
|
-
|
-
|
-
|
$7,743
|
$3
|
$2,581
|
||||||||||||
Total
|
$189,950
|
$64
|
$2,968
|
$69,365
|
$24
|
$2,890
|
$259,315
|
$88
|
$2,947
|
PivotMatrix::create(array(
...
'map' => array(
'rowField' => function($rowField, $fieldInfo) {
$v = $dataField;
if ($v === 'customerName')
$v = 'Customer';
else if ($v === 'productLine')
$v = 'Category';
else if ($v === 'productName')
$v = 'Product';
return $v;
},
'columnField' => function($colField, $fieldInfo) {
$v = $dataField;
if ($v === 'orderYear')
$v = 'Year';
else if ($v === 'orderMonth')
$v = 'Month';
return $v;
},
),
...
));
|
|||||||||||||||||||||||||||||||||||||
dollar_sales - sum
|
Year
orderQuarter
|
||||||||||||||||||||||||||||||||||||
Customer
Category
Product
|
|
||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||
Page size: |
What People Are Saying
"KoolReport helps me very much in creating data report for my corporate! Keep up your good work!"
--
Alain Melsens
"The first use of your product. I was impressed by its easiness and powerfulness. This product is a great and amazing."
--
Dr. Lew Choy Onn
"Fantastic framework for reporting!"
--
Greg Schneider