KoolReport's Forum

Official Support Area, Q&As, Discussions, Suggestions and Bug reports.
Forum's Guidelines

Use of the custom Pivot control #1137

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

Daniel Amamoo-Otchere commented on Oct 25, 2019

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, 2019

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!

Build Your Excellent Data Report

Let KoolReport help you to make great reports. It's free & open-source released under MIT license.

Download KoolReport View demo
help needed

Pivot