KoolReport's Forum

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

Help with progress card #1029

Open Daniel Amamoo-Otchere opened this topic on on Aug 6, 2019 - 6 comments

Daniel Amamoo-Otchere commented on Aug 6, 2019

Hello Kool Team, I am trying out the Progress card and will want to achieve the following from a query below

				->query("select 
						to_char(coalesce(max(date_approved),current_date), 'MON,YYYY') as cur_year,
						coalesce(sum(comp_amount),150000) as comp_value, 
						coalesce(sum(budget_value),1000000) as base_value
						FROM 
						a
						inner join b on a.la_project_id=b.la_project_id
						inner join c on b.la_project_id=c.la_project_id
						")->pipe($this->dataStore("crop_card"));

I want the query to supply the values for "title", "infoText" "value"=>7500 and "baseValue" as found in your sample below so that every thing is dynamic. How do I go about it from your sample below

\koolreport\amazing\ProgressCard::create(array(
    "title"=>"April 2018",
    "infoText"=>"The sale on April 2018 has completed {indicatorValue} of revenue target.",
    "value"=>7500,
    "preset"=>"primary",
    "baseValue"=>10000,
    "format"=>array(
        "value"=>array(
            "prefix"=>"$"
        ),
        "indicator"=>array(
            "decimals"=>0
        )
    ),
    "cssClass"=>array(
        "icon"=>"fa fa-euro"
    ),
));
KoolReport commented on Aug 7, 2019

Hi,

If all your data are available in the "crop_card" data store then you can easily to get those value with get() function:

$this->dataStore("crop_card")->get(0,"columnName");

The get() take 2 params, The first one is the row index and the second one is the column name. You can supply directly to "value" and "baseValue" like this:

"value"=>$this->dataStore("crop_card")->get(0,"columnName")

Let me know if you need further assistance.

Daniel Amamoo-Otchere commented on Aug 7, 2019

Hello, Many thanks. It worked but getting the following error

Here is the code block used

 ProgressCard::create(array(
            "title"=>$this->dataStore("crop_card")->get(0,"cur_year"),
            "infoText"=>"Met {indicatorValue} of Land Access expenditure target.",
            "value"=>$this->dataStore("crop_card")->get(1,"comp_value"),
            "preset"=>"primary",
            "baseValue"=>$this->dataStore("crop_card")->get(2,"base_value"),
            "format"=>array(
                "value"=>array(
                    "prefix"=>"GH¢"
                ),
                "indicator"=>array(
                    "decimals"=>0
                )
            ),
         /*    "cssClass"=>array(
                "icon"=>"fa fa-usd"
            ), */
        ));

The values coming out of the script $this->dataStore("crop_card")->get(2,"base_value"), is 0. But actual data format is numeric, must it be varchar?

I do not get the value displaying but rather 0 displays. Please I need urgent help!.

KoolReport commented on Aug 7, 2019

Could you please check if your "base_value" is 0 or NULL. This could cause the issue for calculate called division by zero and also the infoText will not be available. We do assume that progress card should have baseValue and baseValue is not null or 0.

Daniel Amamoo-Otchere commented on Aug 7, 2019

Hello, Base value will not be zero giving the query values as shown. if it is null it will default to 1000000


coalesce(sum(comp_amount),150000) as comp_value, 
coalesce(sum(budget_value),1000000) as base_value
Daniel Amamoo-Otchere commented on Aug 8, 2019

Hello Any help?

KoolReport commented on Aug 8, 2019

Just make a test, please try to set any value to baseValue like "baseValue"=>10000? Let me know if it work

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

Amazing Theme