KoolReport's Forum

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

How do I add dynamic columns #1180

Open Ron opened this topic on on Nov 25, 2019 - 54 comments

Ron commented on Nov 25, 2019

Hello,

I have a data source and I want to add to it two type of columns during the init of the report

  1. Row 1 columns that shows all the dates in a month for example 1|2|3|4|5|6 etc.
  2. below that row it will show the day of each date for example s|m|t|w|t etc.

the rows show be added to the datasource columns (10 columns ) are coming from the data source. columns from the data source should be rowspan=2 and the dynamic date columns show be a separate row each so it should look something like this

Ron commented on Nov 25, 2019

btw the red columns shows Saturday. so I need also to be capable to set it dynamically once the report is rendered.

David Winterburn commented on Nov 28, 2019

HI Ron,

How do you fill in data for each day column? Please show an example of your data row. Thanks!

Ron commented on Nov 28, 2019

Hi David,

Thank you for answering. In the meantime I managed to overcome a problem in my report. instead of trying to generate the date columns (all dates in selected month) dynamically in the report side I did it in MySQL stored procedure side. that way I already receive all the columns ready. You can view the report (although it's data is in Hebrew) in the following link: https://www.parashapp.com/dev/sbm/report now I have the following issues: a. I want to set settings to the columns in the report like for example: align-right or type=string etc for specific columns but I do not want to write it in the columns array because I do not know the names of the columns I get from the report because if it generated dynamically. b. I do I join all the cells of substitute_teacher_name. I do not need it to appear in each row. c. each substitute teacher has two rows or more for teacher_name I need to join the cells the relevant teacher_name. d. I need to add a calculated new row that sum each two rows of a teacher_name and sum the total_hours. Thanks

David Winterburn commented on Nov 29, 2019

Hi Ron,

It's a bit hard to understand your description as we could not view your page (it requires a login). Do you mind posting a screenshot/mockup with some drawing to explain your requirement? Thanks much!

Ron commented on Dec 3, 2019

OK I tried to make it as simple as possible to understand

Ron commented on Dec 3, 2019

This is the current code for the table view

Table::create(array(
            'dataStore'=>$this->dataStore('Substitutes'),
            'columns'=>array(
                '{others}'=>array(
                    'formatValue'=>function($value)
                    {
                        return $value == NULL ? '' : $value;
                    }
                ),
                'total_hours'=>array(
                    'label'=>lang('cost')
                ),
            ),
            'cssClass'=>array(
                'table'=>'table table-hover table-bordered',
                'tr'=>'cssItem',
                'td'=>function($row,$colName)
                {
                    return in_array($colName, array('substitute_teacher_name','id_number','full_address','bank_account','teacher_name','group_name')) ? 'rext-right' : 'text-center';
                },
                'th'=>function($colName)
                {
                    return in_array($colName, array('substitute_teacher_name','id_number','full_address','bank_account','teacher_name','group_name')) ? 'cssHeader text-right' : 'cssHeader text-center';
                },
            ),
            "paging"=>array(
                "pageSize"=>25,
                "pageIndex"=>0,
            ),
            "grouping"=>array(
                "substitute_teacher_name"=>array(
                    "calculate"=>array(
                        "{sumAmount}"=>array("sum","total_hours"),
                    ),
                    "bottom"=>'<b>{substitute_teacher_name}: {sumAmount}</b>',
                ),
            ),
            "excludedColumns"=>array("total_hours")
        ));
David Winterburn commented on Dec 4, 2019

Hi Ron,

Regarding your requirement in the screenshot:

  1. At the moment the Table widget hasn't supported creating colspan, rowspan in the header yet. If you use datagrid/DataTables widget there's an available solution for such complex headers.

  2. Again, the Table widget has no way to set its columns' label with a function but you could set a datastore metadata programmatically like this:

//MyReport.php

public function setup()
{
    ...
    ->pipe(new \koolreport\processes\Map(array(
        "{meta}" => function($meta) {
            $colMetas = $meta["columns"];
            foreach ($colMetas as $colKey => $colMeta) {
                $colMetas[$colKey]["label"] = modify($colKey);
            }
            $meta["columns"] = $colMetas;
            return $meta;
        }
    )))
    ->pipe($this->dataStore("myDatastore"));
}
  1. To export a whole table to pdf, just remove paging option in the Table/DataTables widget create in your pdf view file instead of your report view file.

Hope this help! Thanks!

Ron commented on Dec 4, 2019

Thanks for you swift replay! Does it means that I need to go Pro? if yes I will purchase it now can you help me achieve the solution? Can I still get the price with the 40% off?

David Winterburn commented on Dec 4, 2019

Hi Ron,

You could buy the Datagrid package if you only need DataTables widget or you could by Pro version if you need to use other packages as well.

As for complex table header with rowspan, colspan, we have option in DataTables to enable that. Thanks!

Ron commented on Dec 4, 2019

Ok. I will go pro! Can you send me please the solution using the DataTables

Ron commented on Dec 4, 2019

Yesterday I got a different price of 218 USD including Perpetual Usage For Developer License. now the price is 298. is there an option to still get this price?

Ron commented on Dec 4, 2019

is it possible?

Ron commented on Dec 4, 2019

Order complete. is there a more convenient way to get support like instant message or email for pro license?

David Winterburn commented on Dec 5, 2019

Hi Ron,

In order to use header hierarchy with datagrid/DataTables please set up your table columns in the following format:

GroupA Cat1.1 - Cat2.1 Cat1.1 - Cat2.2

Then create DataTables like this:

        DataTables::create([
          'dataSource' => $ds,
          'complexHeaders' => true,
          'headerSeparator' => ' - ',
        ]);

You could replace the separator " - " with anything your like, such as " || ", etc. DataTables would divide the headers using the separator and put in rowspan, colspan in th for you.

Please try this with simple data and let us know the result. Thanks!

P.S: To get support you could either post your question here or send email to support@koolphp.net. We will try to answer in the next 24 hours if we find a quick solution. Some hard issues could take more time to solve. Thanks a lot!

Ron commented on Dec 5, 2019

Can you show me a sample code how the column header should look like. please note that the second row of the header should be calculated dynamically on report render because it shows the day of week of for each column in the first row that display the date.

Ron commented on Dec 5, 2019

You said the the header format should look like this GroupA Cat1.1 - Cat2.1 Cat1.1 - Cat2.2 how do I code it in the columns property

David Winterburn commented on Dec 5, 2019

In your specific case, Map process could be useful:

->pipe(new \koolreport\processes\Map(array(
    "{value}" => function($row, $metaData, $index, $mapState) {
        for ($monthday=1; $monthday<=30; $monthday++) {
			$weekday = getWeekday($monthday);
			$row[$monthday . " - " . $weekday] = $row[$monthday];
			unset($row[$monthday]);
		}           
        return $row;
    }
)))
...

You would need to write function getWeekday to compute weekday from monthday. Then try the DataTables set up in my previous post. Thanks!

Ron commented on Dec 5, 2019

ok tnx it did the job but now i caused two issues 1. all the columns with the date and weekday were pushed to the end of the table and the last columns coming before it. 2. How do I align label of the columns to be in the middle of the row vertically and horizontally

Ron commented on Dec 5, 2019

here is the image.

another two questions please: 1. in the column substitute_teacher_id I want the name of the teacher to appear only one time for each group of rows. meaning I want to rowspan it. and same for the column teacher_id.

  1. eventually in the end I want to export all of it to an excel file. what do I need to do in order for the excel to look exactly like the tadatable.
David Winterburn commented on Dec 5, 2019

Hi Ron,

  1. Please try this:
->pipe(new \koolreport\processes\Map(array(
    "{value}" => function($row, $metaData, $index, $mapState) {
        $newRow = [];
        foreach ($row as $k => $v) {
            if (is_numeric($k)) $k = 1*k;
            if ($k >= 1 && $k <= 30) { //i.e $k is month day
                $weekday = getWeekday($k);
		$newRow[$k. " - " . $weekday] = $row[$k];
            } else {
                $newRow[$k] = $row[$k];
            }
        }
                
        return $newRow;
    }
)))
  1. As for centering label, please use CSS:

https://stackoverflow.com/questions/5703552/css-center-text-horizontally-and-vertically-inside-a-div-block

Hope that help!

Ron commented on Dec 5, 2019

ok its working tnx. 1. in the column substitute_teacher_id I want the name of the teacher to appear only one time for each group of rows. meaning I want to rowspan it. and same for the column teacher_id. 2. this code is not working now since we shifted from table to datatable

"grouping"=>array(
                "substitute_teacher_id"=>array(
                    "calculate"=>array(
                        "{sumAmount}"=>array("sum","total_hours"),
                    ),
                    "bottom"=>'<b>{substitute_teacher_id}: {sumAmount}</b>',
                ),
            ),
            "excludedColumns"=>array("total_hours")
  1. eventually in the end I want to export all of it to an excel file. what do I need to do in order for the excel to look exactly like the tadatable.
Ron commented on Dec 8, 2019

Good morning. still waiting for your response on my last email/post

David Winterburn commented on Dec 9, 2019

Hi Ron,

To use grouping in datagrid/DataTables, please use the following format:

DataTables::create(array(
	...
	"options" => array(
		'rowGroup' => [
		  'dataSrc' => [10], //10 is the order of the column you want to group
		  "endRender" => "function ( rows, group ) {
                var salaryAvg = rows
                    .data()
                    .pluck(5) //5 is the order of the salary column
                    .reduce( function (a, b) {
                        return a + b.replace(/[^\d]/g, '')*1;
                    }, 0) / rows.count();
                salaryAvg = $.fn.dataTable.render.number(',', '.', 0, '$').display( salaryAvg );
 
                var ageAvg = rows
                    .data()
                    .pluck(3) //3 is the order of the age column
                    .reduce( function (a, b) {
                        return a + b*1;
                    }, 0) / rows.count();
 
                return $('<tr/>')
                    .append( '<td colspan=3>Averages for '+group+'</td>' )
                    .append( '<td>'+ageAvg.toFixed(0)+'</td>' )
                    .append( '<td/>' )
                    .append( '<td>'+salaryAvg+'</td>' );
            }"
		],
	),
	...
));

I use this grouping with averaging example from this link:

https://datatables.net/extensions/rowgroup/examples/initialisation/customRow.html

You could easily replace average with sum by removing the dividing by rows.count(). Let me know if you have any question. Thanks!

Ron commented on Dec 9, 2019

ok tnxs I will try it. How do I export all this datatable with is same format (complex header) to excel. you can see in the above messages an image with the columns of the datatable.

David Winterburn commented on Dec 9, 2019

Hi Ron,

Sorry for missing your excel export question. At the moment our excel Table widget hasn't had the ability to export grouping and complex headers yet. It's in our roadmap for the Excel package but it could take some time to develop, probably several months in the future.

If and when it's tested or released you would get the update automatically with your current KoolReport Pro license. Let us know your thought. Thanks!

Ron commented on Dec 9, 2019

David, the only reason I purchased koolreport is in order to generate this report in excel. if I can not make it with the current package so its useless for me.

David Winterburn commented on Dec 9, 2019

Hi Ron,

datagrid/DataTables is a html/js/css widget which has features such as complex headers and grouping as I promised.

The ability to export to Excel depends on the Excel package which has its own Table, Chart, PivotTable widgets. At the moment the Excel package has not supported complex headers or grouping yet.

If you need this feature as soon as possible I would suggest using a client-side solution like this:

https://datatables.net/extensions/buttons/examples/initialisation/export.html

In order to do this please download the datatables.min.js including all the plugins in this example and replace the file KoolReport/datagrid/DataTables/datatables.min.js with it:

https://datatables.net/download/

Hope this helps! Let us know if there's any difficulty. Thanks!

Ron commented on Dec 10, 2019

ok. tnx for the option. I did not try it yet because I am still busy with the other two issues. hope it will eventually work in the excel. in the meantime I need you assistant. How fo I hide a column in the datatable?

Ron commented on Dec 11, 2019

??

David Winterburn commented on Dec 11, 2019
DataTables::create(array(
	...
	"options" => array(
		'columnDefs' => array(
			array(
				'visible' => false,
				'targets' => [0], //hide the first column
			)
		),
	),
	...
)); 
Ron commented on Dec 11, 2019

tnx sir. I have a problem in my header columns label. I do a map process to change the label names to the relevent language and when I var_dum the $meta I see that the column names were changed correctly but when the report is displays I still see the original datasource column names

this is the code

->pipe(new \koolreport\processes\Map(array(
            "{meta}" => function($meta) {
                $colMetas = $meta["columns"];
                $index = 1;
                foreach ($colMetas as $colKey => $colMeta) {
                    if ( $index < 7 || $index > sizeof($colMetas) - 2 ) {
                        $colMetas[$colKey]["label"] = lang($colKey);
                        $colMetas[$colKey]["type"] = "string";
                    }
                    $index++;
                }
                $meta["columns"] = $colMetas;
                //echo "<pre>";
                //var_dump($meta);
                //echo "</pre>";
                return $meta;
            }
        )))
David Winterburn commented on Dec 11, 2019

Could you please post your Table::create setup? There's a chane the setup could override the datastore's column meta.

Ron commented on Dec 11, 2019
DataTables::create(array(
            "dataSource"=>$this->dataStore("st"),
            "options"=>array(
                "searching"=>false,
                "paging"=>false,
                'columnDefs' => array(
        			array(
        				'visible' => false,
        				'targets' => [37], //hide the first column
        			)
        		),
        		'rowGroup' => [
        		     'dataSrc' => [0], //10 is the order of the column you want to group
        		     'endRender' => "function ( rows, group ) {
                         var salaryAvg = rows
                            .data()
                            .pluck(5) //5 is the order of the salary column
                            .reduce( function (a, b) {
                                return a + b.replace(/[^\d]/g, '')*1;
                            }, 0) / rows.count();
                        salaryAvg = $.fn.dataTable.render.number(',', '.', 0, '$').display( salaryAvg );

                        return $('<tr/>')
                            .append( '<td colspan=39>סה״כ שעות מילוי מקום למורה '+group+'</td>' )
                            .append( '<td/>' )
                            .append( '<td>'+salaryAvg+'</td>' );
                    }"
        		],
            ),
            'complexHeaders' => true,
            'headerSeparator' => ' - ',
            'cssClass'=>array(
                'table'=>'table table-hover table-bordered',
                'tr'=>'cssItem',
                'td'=>function($row,$colName)
                {
                    return in_array($colName, array('substitute_teacher_id','id_number','full_address','bank_account','teacher_id','group_name')) ? 'cssItem rext-right' : 'cssItem text-center';
                },
                'th'=>function($colName)
                {
                    return in_array($colName, array('substitute_teacher_id','id_number','full_address','bank_account','teacher_id','group_name')) ? 'cssHeader text-right' : 'cssHeader text-center';
                },
            ),
        ))
Ron commented on Dec 11, 2019

I think I found the bug. when I set 'complexHeaders' => true, then this problem appears but when it set to false then I see the correct column labels as set in the Map process. Can you please look into it.

Ron commented on Dec 11, 2019

this is the setup of the report

function setup()
    {
        $this->src('sbm')
        ->query('CALL getSubstituteTeacherHourListPerMonth(:year, :date)')
        ->params(array(
            ":year"=>$this->params["year"],
            ":date"=>$this->params["date"]
        ))
        ->pipe(new \koolreport\processes\Map(array(
            "{value}" => function($row, $metaData, $index, $mapState) {
                $days = array('א','ב','ג','ד','ה','ו','ש');
                $month = date('m', strtotime($this->params["date"]));
                $year = date('Y', strtotime($this->params["date"]));
                $newRow = [];
                foreach ($row as $k => $v) {
                    if (is_numeric($k))
                        $k = 1*$k;
                    if ($k >= 1 && $k <= 31) { //i.e $k is month day
                        $weekday = date('w', strtotime($year.'-'.$month.'-'.$k));
        		        $newRow[$k. " - " . $days[$weekday]] = $row[$k];
                    } else {
                        $newRow[$k] = $row[$k];
                    }
                }
                return $newRow;
            }
        )))
        ->pipe(new \koolreport\processes\Map(array(
            "{meta}" => function($meta) {
                $colMetas = $meta["columns"];
                $index = 1;
                foreach ($colMetas as $colKey => $colMeta) {
                    if ( $index < 7 || $index > sizeof($colMetas) - 2 ) {
                        $colMetas[$colKey]["label"] = lang($colKey);
                        $colMetas[$colKey]["type"] = "string";
                    }
                    $index++;
                }
                $meta["columns"] = $colMetas;
                //echo "<pre>";
                //var_dump($meta);
                //echo "</pre>";
                return $meta;
            }
        )))
        ->pipe($this->dataStore("st"));
    }
David Winterburn commented on Dec 12, 2019

Hi Ron,

Yes, you are correct. The complex headers feature must modify/split the table's header content and because it performs modification on the column name, the column label isn't shown. Even if we want to show the label, says a column is {name: "group 1 - cat 1.1", label: "my column label"} which text should be shown for header cat1.1?

If you really want to to localize the headers I would suggest changing the column name directly and not the column label, i.e apply the lang() function in the first Map process. Thanks!

Ron commented on Dec 12, 2019

how to I join the two map processes. actually if I can change the meta in the first process then I do not need the second one. can you please tell me how do I change the label of the meta from the first map process?

->pipe(new \koolreport\processes\Map(array(
            "{value}" => function($row, $metaData, $index, $mapState) {
                $days = array('א','ב','ג','ד','ה','ו','ש');
                $month = date('m', strtotime($this->params["date"]));
                $year = date('Y', strtotime($this->params["date"]));
                $newRow = [];
                foreach ($row as $k => $v) {
                    if (is_numeric($k))
                        $k = 1*$k;
                    if ($k >= 1 && $k <= 31) { //i.e $k is month day
                        $weekday = date('w', strtotime($year.'-'.$month.'-'.$k));
        		        $newRow[$k. " - " . $days[$weekday]] = $row[$k];
                    } else {
                        $newRow[$k] = $row[$k];
                    }
                }
                return $newRow;
            }
        )))
David Winterburn commented on Dec 12, 2019

Hi Ron,

One Map process allows for both "{value}" and "{meta}" properties. However, in your case I think we could change the 2nd Map process like this:

        ->pipe(new \koolreport\processes\Map(array(
            "{value}" => function($row, $metaData, $index, $mapState) {
                $days = array('א','ב','ג','ד','ה','ו','ש');
                $month = date('m', strtotime($this->params["date"]));
                $year = date('Y', strtotime($this->params["date"]));
                $newRow = [];
                foreach ($row as $k => $v) {
                    if (is_numeric($k))
                        $k = 1*$k;
                    if ($k >= 1 && $k <= 31) { //i.e $k is month day
                        $weekday = date('w', strtotime($year.'-'.$month.'-'.$k));
        		        $newRow[$k. " - " . $days[$weekday]] = $row[$k];
                    } else {
                        $newRow[$k] = $row[$k];
                    }
                }
                return $newRow;
            }
        )))
        ->pipe(new \koolreport\processes\Map(array(
            "{value}" => function($row, $meta) {
                $colMetas = $meta["columns"];
                $index = 1;
                $newRow = [];
                foreach ($colMetas as $colKey => $colMeta) {
                    if (! isset($row[$colKey])) continue;
                    if ( $index < 7 || $index > sizeof($colMetas) - 2 ) {
                        $newKey = lang($colKey);
                        $newRow[$newKey] = $row[$colKey];
                    } else {
                        $newRow[$colKey] = $row[$colKey];
                    }
                    $index++;
                }
                return $newRow;
            }
        ))) 

Let me know how it works. Thanks!

Ron commented on Dec 12, 2019

its does the job BUT it removes all the date columns beside one. please see picture

David Winterburn commented on Dec 13, 2019

Which columns should the lang() function apply to? You could apply it directly in the 1st Map process and remove the 2nd one.

Ron commented on Dec 13, 2019

The lang should apply only to the 2st not to the dates with the values 1 to 31 only to to columns that comes from the data source

David Winterburn commented on Dec 13, 2019
        ->pipe(new \koolreport\processes\Map(array(
            "{value}" => function($row, $metaData, $index, $mapState) {
                $days = array('א','ב','ג','ד','ה','ו','ש');
                $month = date('m', strtotime($this->params["date"]));
                $year = date('Y', strtotime($this->params["date"]));
                $newRow = [];
                foreach ($row as $k => $v) {
                    if (is_numeric($k))
                        $k = 1*$k;
                    if ($k >= 1 && $k <= 31) { //i.e $k is month day
                        $weekday = date('w', strtotime($year.'-'.$month.'-'.$k));
        		        $newRow[$k. " - " . $days[$weekday]] = $row[$k];
                    } else {
                        if (shouldApplyLang($k)) $k = lang($k); //write your shouldApplyLang function
                        $newRow[$k] = $row[$k];
                    }
                }
                return $newRow;
            }
        ))) 
Ron commented on Dec 13, 2019

This is the code of the setup: ` function setup()

{
    $this->src('sbm')
    ->query('CALL getSubstituteTeacherHourListPerMonth(:year, :date)')
    ->params(array(
        ":year"=>$this->params["year"],
        ":date"=>$this->params["date"]
    ))
    ->pipe(new \koolreport\processes\Map(array(
        "{value}" => function($row, $metaData, $index, $mapState) {
            $days = array('א','ב','ג','ד','ה','ו','ש');
            $month = date('m', strtotime($this->params["date"]));
            $year = date('Y', strtotime($this->params["date"]));
            $newRow = [];
            foreach ($row as $k => $v) {
                if (is_numeric($k))
                    $k = 1*$k;
                    if ($k >= 1 && $k <= 31) { //i.e $k is month day
                        $weekday = date('w', strtotime($year.'-'.$month.'-'.$k));
        		        $newRow[$k. " - " . $days[$weekday]] = $row[$k];
                    } else {
                        //echo $k."<br>";
                        if ( in_array($k, array('substitute_teacher_id','id_number','full_address','bank_account','teacher_id','hour_group_id', 'cost', 'total_travel_cost') ) ) {
                            $k = lang($k);
                        }
                        $newRow[$k] = $row[$k];
                    }
                }
                return $newRow;
            }
    )))
    ->pipe($this->dataStore("st"));
}
it gives an error :

A PHP Error was encountered
Severity: Notice

Message: Undefined index: סה״כ עלות נסיעות

Filename: reports/MyReport.php

Line Number: 50

Backtrace:

File: /var/www/parashapp.com/public_html/dev/sbm/application/reports/MyReport.php
Line: 50
Function: _error_handler

File: /var/www/parashapp.com/public_html/dev/sbm/application/libraries/koolreport/core/src/processes/Map.php
Line: 137
Function: {closure}

File: /var/www/parashapp.com/public_html/dev/sbm/application/libraries/koolreport/core/src/core/Node.php
Line: 244
Function: onInput

File: /var/www/parashapp.com/public_html/dev/sbm/application/libraries/koolreport/core/src/core/Node.php
Line: 201
Function: input

File: /var/www/parashapp.com/public_html/dev/sbm/application/libraries/koolreport/core/src/datasources/PdoDataSource.php
Line: 487
Function: next

File: /var/www/parashapp.com/public_html/dev/sbm/application/libraries/koolreport/core/src/KoolReport.php
Line: 315
Function: start

File: /var/www/parashapp.com/public_html/dev/sbm/application/controllers/Report.php
Line: 19
Function: run

File: /var/www/parashapp.com/public_html/dev/sbm/index.php
Line: 315
Function: require_once


it seems that the map process is running on each row of the table which is pointless. the only rows I needed is the 1st and 2nd rows of the header in order to update the lang() parameters.
David Winterburn commented on Dec 16, 2019
                        $originalK = $k;
                        if ( in_array($k, array('substitute_teacher_id','id_number','full_address','bank_account','teacher_id','hour_group_id', 'cost', 'total_travel_cost') ) ) {
                            $k = lang($k);
                        }
                        $newRow[$k] = $row[$originalK];

Regarding your opinion about the Map process, each row of KoolReport's pipe data is an associative array so you need to change every row in order to change the column names.

Ron commented on Dec 18, 2019

tnx its working. one of my datasource columns called 'total_travel_cost' is a variant type double. the numbers inside the datasource are like 15.26 or 13.45 but when I display it in the datatable it shows 15.600000000000001. can I prevent it?

David Winterburn commented on Dec 19, 2019

Hi Ron,

Please set the column meta for "total_travel_cost" like this:

->pipe(new \koolreport\processes\ColumnMeta(array(
    "total_travel_cost" => array(
        "type" => "number",
        "decimals" => 2,
        "decimalPoint" => ".",
        "thousandSeparator" => ",",
    )
)))

or set the column option directly with DataTables:

DataTables::create(array(
    ...
    "columns" => array(
        ...
        "total_travel_cost" => array(
            "type" => "number",
            "decimals" => 2,
            "decimalPoint" => ".",
            "thousandSeparator" => ",",
        ),
        ...
    ),    
    ...    
));
Ron commented on Dec 19, 2019

thanks david. your support is great!

Ron commented on Dec 19, 2019

when I do this ` ->pipe(new \koolreport\processes\ColumnMeta(array(

"total_travel_cost" => array(
    "type" => "number",
    "decimals" => 2,
    "decimalPoint" => ".",
    "thousandSeparator" => ",",
)

))) `

I still get in one of the rows values of the column total_travel_cost the value 15.600000000000001

Ron commented on Dec 19, 2019

ok never mind. I fixed it in the stored procedure side using truncate function on the field itself. thanks anyway

Ron commented on Dec 26, 2019

This is the report view code

Table::create(array(
            "dataSource"=>$this->dataStore("st"),
            "columns"=>array(
                "hour_num"=>array(
                    'label'=>'Hour',
                ),
                "1"=>array(
                    "label"=>"Sunday",
                    "type"=>"string",
                ),
                "2"=>array(
                    "label"=>"Monday",
                ),
                "3"=>array(
                    "label"=>"Tuesday",
                ),
                "4"=>array(
                    "label"=>"Wednesday",
                ),
                "5"=>array(
                    "label"=>"Thursday",
                ),
                "6"=>array(
                    "label"=>"Friday",
                ),
            ),
            "cssClass"=>array(
                "table"=>"table table-bordered",
                "th"=>"table-dark",
            )
        ))

using this code I can see only the cube columns but no the data inside the row.

Ron commented on Dec 26, 2019

when I remove the columns setting in the table create I can see the following

Ron commented on Dec 26, 2019

Ron commented on Dec 26, 2019
  1. I don't need the {{all}} column
  2. I want to change the names of the header days and hours on the right from number to text
Ron commented on Dec 26, 2019

my mistake I posted all in the wrong post

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
None yet

None