KoolReport's Forum

Official Support Area, Q&As, Discussions, Suggestions and Bug reports.

Help with progress card #1029

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

Daniel Amamoo-Otchere commented on Aug 6

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

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

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

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

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

Hello Any help?

KoolReport commented on Aug 8

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

KoolReport Is Free and Open-Source!

KoolReport is a professional php reporting framework which saves you tons of time to construct dynamic data report & dashboard.

  • Connect to various datasources such as MySQL, SQL Server, MongoDB or even from CSV or Excel file.
  • Contain series of powerful built-in data processes for your data manipulation.
  • Generate stunning charts and graphs to help you communicate data insights to your audiences effectively.
  • Integrate seamlessly with any php frameworks such as Laravel, CodeIgniter, Symfony.
Download Now and register our tutorials to get started!

Download KoolReport
help needed

Amazing Theme