Dear David,
I've tried to bind (first of all only 1) input element (multiselect) into my PivotTable report so that the user can select the needed companies and load the corresponding report. If this works fine, in the next step I would like to bind much more elements for having a big "search field" with several input elements for easy retrieving of selected data.
For this pupose I tried the examples on github but at this moment I am a little bit lost and need your help.
Here is my pivot php:
<?php
require_once "../koolreport/autoload.php";
use \koolreport\processes\Filter;
use \koolreport\processes\ColumnMeta;
use \koolreport\pivot\processes\Pivot;
use \koolreport\processes\Group;
use \koolreport\processes\Sort;
use \koolreport\processes\Limit;
class autoreppivot extends koolreport\KoolReport
{
use \koolreport\clients\FontAwesome; //für die Collapse + icons
use \koolreport\clients\Bootstrap;
use \koolreport\inputs\Bindable;
use \koolreport\inputs\POSTBinding;
protected function defaultParamValues()
{
return array(
"werbegruppen" => array(
"Einzelhaus"
),
);
}
protected function bindParamsToInputs()
{
return array(
"werbegruppen"=>"werbegruppen",
);
}
function settings()
{
return array(
"dataSources"=>array(
"sales"=>array(
'connectionString' => 'sqlsrv:Server=tcp:12.34.56.789;Database=test',
'username' => 'sa',
'password' => '****',
),
)
);
}
function setup()
{
$node = $this->src('sales')
->query("SELECT Geschaeftsjahr, Monat, WerbegruppeVerbund, NikonKdName, NikonProdGruppe, Verkaufsmenge, Umsatz FROM Reporting.autorep_v_noNulls")
->pipe(new Pivot(array(
"dimensions" => array(
"column" => "Monat",
"row" => "WerbegruppeVerbund, NikonKdName, NikonProdGruppe"
),
"aggregates" => array(
"sum" => "Umsatz",
)
)))
->pipe($this->dataStore('Reporting.autorep_v_noNulls'));
}
}
Here is the view php:
<?php
use \koolreport\pivot\widgets\PivotTable;
use \koolreport\inputs\MultiSelect;
?>
<form method="post">
<div class="row">
<div class="col-md-8 col-md-offset-2">
<div class="form-group">
<?php
MultiSelect::create(array(
"name"=>"werbegruppen",
"dataStore"=>$this->dataStore("Reporting.autorep_v_noNulls"),
"dataBind"=>array(
"text"=>"WerbegruppeVerbund",
"value"=>"WerbegruppeVerbund",
),
"attributes"=>array(
"class"=>"form-control",
"size"=>10,
)
));
?>
</div>
<div class="form-group text-center">
<button class="btn btn-success"><i class="glyphicon glyphicon-refresh"></i> Submit</button>
</div>
</div>
</div>
</form>
<hr/>
<?php
PivotTable::create(array(
"dataStore"=>$this->dataStore('Reporting.autorep_v_noNulls'),
"measures" => array(
"Umsatz - sum",
),
"headerMap" => array(
"Umsatz - sum" => "∑ Umsatz",
),
"rowCollapseLevels" => array(1), //0 = zu, 1 = auf
"columnCollapseLevels" => array(0),
"totalName" => 'GESAMT'
));
?>
</div>
</div>
</body>
</html>
The result is now an empty multiselect field (here the field "WervegruppeVerbund" should be retrieved. And of course no working "Submit" button. The result should be a pivot table containing only from the WerbegruppeVerbund companies which are selected by the user:
Any hints for me?
Kind regards