KoolReport's Forum

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

Table based on multiple queries #114

Open zenon opened this topic on on Sep 19, 2017 - 5 comments

zenon commented on Sep 19, 2017

Hi KoolReport,

Currently, I managed to develop tables like Table 2 (based on multiple queries). However, the arrangement is not what it should be. How to develop tables like Table 1 with multiple queries?

Appreciate your help.

Thanks a lot.

KoolReport commented on Sep 19, 2017

How do you know the Department A and B belongs to Division 1? Is there any link in database?

zenon commented on Sep 19, 2017

I think there is.

zenon commented on Sep 19, 2017

And each query can have varied number of columns.

zenon commented on Sep 20, 2017

Hi KoolReport,

Could you please guide me on the above matter?

Appreciate your help.

KoolReport commented on Sep 20, 2017

Hi,

I am sorry for my late reply. Your case is quite difficulty for koolphp/Table to display since data is from different sources and mixing to one table like above is difficult. The solution could be that you create your own tables. First echo date row with total quantity. Second, loop though all the division data from query 2. For each division, you first echo the division data, then you need to search the data from query 2 for departments which link to that division, you also echo the row with department name and quantiy.

We have show you how to get the raw data from dataStore(), don't we?

$rows = $this->dataStore("store_of_query2")->data();
foreach($rows as $row)
{
    echo $row["name"]." ".$row["quantity"];
}

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

None