KoolReport's Forum

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

Some data in the grouped line #628

Closed Eugene opened this topic on on Jan 28, 2019 - 4 comments

Eugene commented on Jan 28, 2019

Hi, I found some information about this question at this forum but could not realize till the end.

I have the following task:

With the following code, I can get almost I would like to have

        Table::create(array(
            "dataStore" => $this->dataStore('recipeDirect'),
            "columns" => array(
                "recipeName" => array(
                    "label" => "Name",
                    "formatValue"=>function($value)
                    {
                        return ""; //Make empty column on Table
                    },
                ),
                "itemName" => array(
                    "label" => "Item Name"
                ),
                "RecQty" => array(
                    "type" => "string",
                    "label" => "Amount",
                )
            ),
            "grouping"=>array(
                "recipeName"=>array(
                    "top"=>"<b>{recipeName} Production: $production</b>",
                ),
            ),
            "removeDuplicate"=>array("recipeName"),
        ));

I know how to hide repeated values, how to put the recipe name to the group header but how to get the $production value for each recipeName?

Regards, Eugene

KoolReport commented on Jan 28, 2019

Please have a look at calculate property, you may use the avg for production

Eugene commented on Jan 28, 2019

I think I am doing something wrong I do like this:

"grouping"=>array(
                "recipeName"=>array(
                    "calculate"=>array(
                        "{prod}"=>array("avg","production"),
                    ),
                    "top"=>"<b>{recipeName} Production: {prod}</b>",
                ),
            ),

but get Apple Crepes Production: {prod}

Eugene commented on Jan 28, 2019

avg was not good for my case because production is a string. max works fine... :-)

KoolReport commented on Jan 28, 2019

that's right :) I thought production was number.

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