KoolReport's Forum

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

DataStore reset #1300

Closed thailon opened this topic on on Feb 13, 2020 - 6 comments

thailon commented on Feb 13, 2020

Hello KoolReport! Please, is there any way to reset DataStore? I literally list 5 the same charts with different data range from the same table, but I have to create 5 DataStores, 5 graphs :(

thanks! Peter

KoolReport commented on Feb 14, 2020

May be what you are looking for is the pipeTree() method. You still need to create 5 datastores but all datastores generated from same source. Meaning you do not need to query again.

thailon commented on Feb 17, 2020

Hi, thank you for your answer. I thought something different. My case: I need to show 5 graphs on the same page. Each graph: looks & and is the same (number of columns, style), has the same dataSource, but shows different data range from the same table. I have to create 5 dataStore(s) to handle different data (make sanse) and 5 the same looking graph definitions in view file (just because of those 5 dataStore(s). What do I look for: is there any change to have something like graph template I just fill with data? thanks!

KoolReport commented on Feb 17, 2020

Okay, another way is to use dataStore filter. For example, you store your data in a datastore $this->dataStore("main"), you can do filter for each chart like this

ColumnChart::create(array(
    "dataSource"=>$this->dataStore("main")->filter("date","between","2010-01-01","2010-03-01");
));

more on filter().

Hope that helps.

thailon commented on Feb 17, 2020

Thank you for very quick reply, yep, this saves dataStores count to one. But If I understand it correctly, you still have to have 5 graph definitions, just with filtered dataStore. Or generate graph definition in the loop of 5, right?

KoolReport commented on Feb 17, 2020

Yes, you make array with 5 different date conditions, then you can loop through conditions and create a chart per condition.

thailon commented on Feb 17, 2020

yes, this is it, many 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
solved

None