KoolReport's Forum

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

General question on usage #1553

Open Richb201 opened this topic on on Aug 4, 2020 - 5 comments

Richb201 commented on Aug 4, 2020

Here is a broad, general question that is related to the philosophy of Kool report. I surely hope you will give me a more than one word answer. I have some data in a table. Some of the related data is in a second table. I do this type of thing in Excel frequently. If I want to build a datastore (so I can create a chart). Am I better to do this fairly complex manipulation in SQL and just create new table which directly addresses what I need, or is piping and the koolreport functions (sort, limit, join, etc) good enough to handle it? I'd prefer a pragmatic answer rather than a theoretical one.

David Winterburn commented on Aug 5, 2020

Hi Richard,

If you don't care about premature optimization (which is only necessary when you handle millions of rows) I would suggest you use the the method you are most familiar or comfortable with. In software it's often the situation that around 20% effort is for building and 80% effort is for maintaining the software. So a software which is written in a familiar method, with a clear and simple implementation is usually the best one to keep and run in the long term.

Regarding your specific question, I think the answer depends on a number of things:

  1. Your skill in sql vs your skill in php.
  2. Who would maintain the reports and their respective skills in sql and php.
  3. The complexity of your reports.

In our experience with building and maintaining reports, we often prefer joining tables with sql (because it's fast and efficient) and doing other manipulation/computation with php (because it's more flexible.)

Hope this answers parts of your question. Thanks!

Richb201 commented on Aug 5, 2020

Thank you. For me the answer is now simple. I need to create fields in my tables that are close to what is needed for the reports. Let's say 95% ready.

Richb201 commented on Aug 8, 2020

Thanks again for the excellent answer. SQL is well documented and that is a great reason to use it. So how do I use it with KoolReport? Once I create some SQL to build some data that I want to display in Koolreport (or D3 or whatever), can I "pipe" the resulting table into a datastore so it can be used? Or must I create a new mySQL table to hold the resulting data so that Koolreport can access it? Another question, do you have any example of using a csv as a datastore?

David Winterburn commented on Aug 10, 2020

Hi Richard,

  1. For the simplest approach just use your sql query and pipe the result to a datastore.

  2. Here's the documentation for using a csv file as datasource for a report: https://www.koolreport.com/docs/datasources/csvdatasource/

Richb201 commented on Aug 10, 2020

thx. got it working.

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