KoolReport's Forum

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

Category number formating and filter bugs. #2892

Closed GHSix opened this topic on on Dec 1, 2022 - 2 comments

GHSix commented on Dec 1, 2022

I'm having 2 difficulties with Category.

1- When formating the Number field it will show right in the list but not in the total above. ("." and "," at list aginst "," and "." at total)

2- When applying Filter, the graph is going crazy. If I take out the Filter::process, the graph will show right.

Here we can see 1 and 2 happening:

Code:

class ProductTopNCM extends Category
{
    protected function onInit()
    {
        $this->title(Lang::t('Top 5 NCM Cat.'))
            ->type('success')
            ->width(1/3)
            ->lazyLoading(true);
    }
    
    protected function dataSource()
    {
        return $this->dashboard()->getDataG1()
            ->run()
            ->process(\koolreport\processes\Filter::process([
                ['ncm', '!=', '.0']
            ]));
    }

    protected function fields()
    {
        return [
            $this->group(Text::create('ncm'))->showTop(5)->andShowOthers(),
            $this->sum(Number::create('qtd_ncm'))->showRawValue(true)->suffix('')->decimals(0)->decimalPoint(Lang::t('.'))->thousandSeparator(Lang::t(',')),
        ];
    }
}
KoolReport commented on Dec 7, 2022

Sorry for the late reply to you. I actually send this to dev.team on the day you post. For the first issue, let try this:

$this->sum(
    Number::create('qtd_ncm')
    ->suffix('')->decimals(0)->decimalPoint(Lang::t('.'))->thousandSeparator(Lang::t(','))
)->showRawValue(true)->suffix('')->decimals(0)->decimalPoint(Lang::t('.'))->thousandSeparator(Lang::t(','))

Let try to set both Number inside the sum and outside. I know this somehow not well yet but could not quick solution for now. It will be solved in next version.

For the second issue, I am not sure why applying the filter make chart go crazy. If possible, you try to show filter data on table and inspect the data.

GHSix commented on Dec 14, 2022

For 1, it worked and the total is right now. But, I have so many of this things already, that I hope the next version with the fix comes out in the coming 3 to 4 weeks so I don't need to change it all.

For 2, I have changed it so much already that I don't know anymore what I did to make it happen. If I stumble it again, I let you know.

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
bug
help needed

Dashboard