KoolReport's Forum

Official Support Area, Q&As, Discussions, Suggestions and Bug reports.

Use of the custom Pivot control #1137

Open Daniel Amamoo-Otchere opened this topic on on Oct 25 - 1 comments

Daniel Amamoo-Otchere commented on Oct 25

Hello Team, Please how do I set the {initvalue} to a variable called grade which is part of the datastore so I can concatenate it with the {appValue} ? so as to show both the final

 $node_orig->pipe(new Pivot(array(
            "dimensions"=>array(
                "column"=>"ay_term,subject_name",
                "row"=>"class_system,name_string ",
            ),
            "aggregates"=>array(
                "myAgg"=>"final_mark,grade",
            ),
			"customAggregates" => [
                "myAgg" => [
                    "{initValue}" => "",
                    "{aggValue}" => function($aggValue, $value) {
                        $newAggValue = $aggValue.$value;
                        return $newAggValue;
						},
					]
			   ],
David Winterburn commented on Oct 28

Hi Daniel,

To get data from a datastore in a report's setup instead of its view, please try the method requestDataSending like this:

->pipe($this->dataStore('myDataStore'))
->requestDataSending();

$myDataStoreData = $this->dataStore('myDataStore')->data();

After this you could use $myDataStoreData for Pivot process' init value. Let me know if this helps you to solve your problem. Thanks!

KoolReport Is Free and Open-Source!

KoolReport is a professional php reporting framework which saves you tons of time to construct dynamic data report & dashboard.

  • Connect to various datasources such as MySQL, SQL Server, MongoDB or even from CSV or Excel file.
  • Contain series of powerful built-in data processes for your data manipulation.
  • Generate stunning charts and graphs to help you communicate data insights to your audiences effectively.
  • Integrate seamlessly with any php frameworks such as Laravel, CodeIgniter, Symfony.
Download Now and register our tutorials to get started!

Download KoolReport
help needed

Pivot