KoolReport's Forum

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

How to make a master-detail report? #3253

Open Steve Faleiro opened this topic on on Feb 24 - 4 comments

Steve Faleiro commented on Feb 24

In MS-Access when designing a report, its possible to put a sub-report object in a report and link Master and Child fields of the subreport object to the main report. Then when displaying the report, if any master record has detail rows, the data from the subreport is displayed as the detail rows.

Is it possible to achieve this with KoolReport? I need to display the report in the browser, and also later export to PDF.

All the examples that I have checked seem to advise putting a hyperlink that when clicked will open the detail report, but this is not what I need. I need to display the sub-report rows inline on the same page.

Thanks in advance!

Sebastian Morales commented on Feb 26

Yes, it's totally possible to load master-detail tables report with ajax call/request with the following solution:

  1. First render the master table and add event listener for the table row's click event.

  2. In the master table's row click event, get the row id/data and send an ajax request to the same report PHP page for a detail table.

  3. In the report PHP page, catch if there is an ajax request for a detail talbe get the detail data and echo the detail table.

  4. In the ajax request success event, render the result detail table.

We have an example using subReport that demonstrates this solution at the following link:

https://www.koolreport.com/examples/reports/others/subreport_demo/

The only difference is that instead of a master table, we use a Select input. You can copy the example's source code at the event of the link and replace the Select input with a Table or DataTables widget.

Let us know if you need any further guide for detail implementation. Rgds,

Steve Faleiro commented on Feb 26

Hi Sebastian,

I mentioned in my original question: "All the examples that I have checked seem to advise putting a hyperlink that when clicked will open the detail report, but this is not what I need. I need to display the sub-report rows inline on the same page."

I do not want a hyperlink with click event that then will open the detail. I need for the detail rows (if any) for each master row to be rendered inline on the same page as the main report, without clicking. Then this same report that is being viewed on the web page needs to be exportable to PDF.

Please let me know if this is possible? If its not possible then I would need to apply for a refund of the KoolReport Pro license that I purchased last week, as the product does not meet my needs. Please let me know. Thanks.

Sebastian Morales commented on Feb 27

Per your desciption, we have table's row group and row detail that might better suits your case:

https://www.koolreport.com/examples/reports/datagrid/rowgroup/

https://www.koolreport.com/examples/reports/datagrid/row_detail/

If your desired solution is a bit different we can always modify the examples for you.

Steve Faleiro commented on Feb 27

Hi Sebastian, I think that this is what I was looking for and it will work for me. Thank you.

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
None yet

None