KoolReport's Forum

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

Different format of a chart #2447

Open Richb201 opened this topic on on Nov 20, 2021 - 8 comments

Richb201 commented on Nov 20, 2021

I have a section of my report that I need to expand. Right now it appears like this:

What I need to show is

BUSINESS COMPONENTS

Business Component: Band In A Box
description:                         asj;fasdjflsdk;fjlf
174:                              xxxxxxxsk;asdlfkS';FL\F
poe:                              kj;sdlfjsd;fklsjk;lj;gl;
substantially:           asdklgadjf;gkljadfglk

Business Component: TI Calculator
description:                         jksadfhlaskfjhlKFJ
174:                              kjfhsdlfhslkdfhsl
poe:                              khslkfhdfkldjfhlksfj
substantially:            lgjdflgjkdf;lgdflagi


I have all the information is a single table. Do you have an example of how to accomplish this type of thing where each field label and value is on a new line?

KoolReport commented on Nov 21, 2021

Hi,

I think you have to create this by yourself. But no worry, it is very simple with 2 loops. Here are step:

  1. Loop through your datastore, with each row you build a html table
  2. Inside the <tbody>, you make another loop though each row items and each of them, you echo a <tr>

That all. Please let me know if you have any difficulty.

Richb201 commented on Nov 21, 2021

OK. Normally when I build a koolreport in the report file I create a datastore like this

       $sql = "SELECT *
        FROM  BC_PR_list_temp as BPlt
       WHERE BPlt.taxyear='$taxyear' AND item!='' AND type='BC'";

        $this->src('substantiator')
            ->query($sql)
            ->pipe($this->dataStore("BPlt_BC"));

Then in the view file I create

the table like this:

Table::create(array(
        "dataStore"=>$this->dataStore("BPlt_BC")->filter("taxyear","=",$_SESSION['last_TY']),
        "showFooter"=>true,
        "grouping"=>array(
            "item"=>array(
                "calculate"=>array(
                    "{sumAmount}"=>array("sum","dollarsPerBC"),
                ),
                "cssStyle"=>"text-align:right",
                "bottom"=>"<td colspan='6 style='text-align: right'><b>Total qualified wages for : {item}</b></td><td style='text-align: right'><b>{sumAmount}</b></td><br>",

            ),
        ),

Now, Are you saying to NOT do it that way at all? Do you want me to do codeigniter3 sql query directly? And then manually build the table? Do you have an example of how that is done?

Sorry, I am pretty simple minded when it comes Koolreport!

KoolReport commented on Nov 22, 2021

No, I do not mean you are not using KoolReport and coding yourself by CodeIgniter. Give me sometime I will write some code for you.

Richb201 commented on Nov 22, 2021

OK. Thanks. A little psuedo code goes a long way.....

Richb201 commented on Nov 28, 2021

Any luck on this?

Richb201 commented on Dec 16, 2021

I am still waiting for some kind of sample. Any ideas?

KoolReport commented on Dec 18, 2021

So so sorry for my late reply. Here comes the code:

<?php
$dataStore = $this->dataStore("BPlt_BC")->filter("taxyear","=",$_SESSION['last_TY']);
?>
<h1>Business Components</h1>
<?php foreach($dataStore as $row): ?>
    <div style="margin-bottom:30px">
        <?php foreach($row as $key=>$value): ?>
            <div class="row">
                <div class="col-md-4">
                    <?php echo $key; ?>   
                </div>
                <div class="col-md-8">
                    <?php echo $value; ?>
                </div>
            </div>
        <?php endforeach ?>        
    </div>
<?php endforeach ?>
Richb201 commented on Dec 18, 2021

thx

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