KoolReport's Forum

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

Sort Method doesn't work #1663

Open Thomas opened this topic on on Oct 14 - 4 comments

Thomas commented on Oct 14


I am trying to sort my DataStore but it won't work. I've tried the following:

KoolReport commented on Oct 14

That's strange. We have tested and it seems fine. Could you please give us more details: the original data, what expected result and the outcome.

Thomas commented on Oct 14

Sure. I converted a multi-dimensional array into a DataStore. Here is the code and the datatable.

    $groups_data_main_survey_koolreport_object = new \koolreport\core\DataStore($groups_data_main_survey);
    $survey_codes_object = new \koolreport\core\DataStore(reset($survey_codes));
    $groups_data_main_survey_object = $survey_codes_object->join($groups_data_main_survey_koolreport_object,array("kfza_code"=>"title")) ;

Thomas commented on Oct 14

I think this is related: https://www.koolreport.com/forum/topics/1656

To use the charts option, I had to transform the object to an array.

Thomas commented on Oct 16

That's a big problem for me. All my arrays aren't accepted by the charts. I have to transform every array into a koolreport object via "new \koolreport\core\DataStore($array);", than I have to sort or filter it and than turn it back into an array via toArray(), otherwise it doesn't work. I don't want to do that for every array I have to be able use it. Because it didn't show up or the labels aren't displayed correctly.

Why can't I use a simple array? Is there an other way to transform the array into a koolreport object?

Do I have to be aware of by creating the array?

Here is the latest array, which I had to transform to be able to use:

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