KoolReport's Forum

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

Count not working with 1 record? #222

Open michelp opened this topic on on Feb 28, 2018 - 5 comments

michelp commented on Feb 28, 2018

Hi,

I'm trying to get data grouped by month. I want to count the number of records within a certain period. I'm using this setup:

  function setup()
    {
        $this->src('yunoport')
            ->query("Select companyname, tblresultid, DATE_FORMAT(tblresultdatetime,'%Y-%m-%d') as resultdate from ci_wizard_results  LEFT JOIN ci_kiosks on ci_wizard_results.tblresultkioskname = ci_kiosks.kioskname LEFT JOIN ci_companies on ci_kiosks.kioskcompanyid = ci_companies.companyid WHERE `tblresultdatetime` >= DATE_FORMAT(DATE_ADD(NOW(),INTERVAL -1 YEAR),'%Y-%m-%d')")
            ->pipe(new Sort(array(
                "tblresultid"=>"asc"
            )))

            ->pipe(new TimeBucket(array(
                "resultdate"=>"month"
            )))
            ->pipe(new Group(array(
                "by"=>"companyname, resultdate",
                "count"=>"tblresultid"
            )))

            

            ->pipe($this->dataStore("wizardresults"));
    }

This shows:

For the record in red, there seems to be a bug. There is only 1 record found, so I would asume it would show 1. However, it shows the record value. 6549 is the id of the record:

How can I get '1' instead?

KoolReport commented on Feb 28, 2018

That's strange. Does it happens to other groups like the one with count of 6272 for example.

michelp commented on Feb 28, 2018

Yeah, It happens to all the 1 record groups

KoolReport commented on Feb 28, 2018

I have sent you the new Group process to your email. Please replace the old file in koolreport/processes folder and let us know.

michelp commented on Feb 28, 2018

Yes, that works! Thanks!!

KoolReport commented on Feb 28, 2018

That's great!

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