KoolReport's Forum

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

DataStore reset #1300

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

thailon commented on Feb 13

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

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 4 days ago

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 4 days ago

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 4 days ago

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 4 days ago

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

thailon commented 4 days ago

yes, this is it, many thanks!

KoolReport is Free and Open-Source!

KoolReport can help you to connect to various datasources, turn your data into valuable insights visualized in stunning charts and graphs.

Download KoolReport View demo
solved

None