KoolReport's Forum

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

How to add href link to pivot total? #2358

Closed Finu opened this topic on on Sep 28, 2021 - 11 comments

Finu commented on Sep 28, 2021

Finu commented on Sep 28, 2021

Hello David Winterburn and KoolReport, can you guys help me out?

Sebastian Morales commented on Sep 28, 2021

Pls describe exactly how you get the href links and how you want to display them in pivot cell? Rgds,

Finu commented on Sep 28, 2021

for the total like this from his KoolReport.

And for the initial code like this. ->pipe(new Pivot(array(

        "dimensions"=>array(
            "column"=>"orderYear, orderMonth",
            "row"=>"customerName, productLine, productName"
        ),
        "aggregates"=>array(
            "sum"=>"dollar_sales",
            "count"=>"dollar_sales"
        )
    )))->saveTo($node2);
    $node2->pipe($this->dataStore('sales')); 

And I want every number in this total to be clickable as an href link.

How to? Please help.

Sebastian Morales commented on Sep 28, 2021

What is the href link for each cell?

Finu commented on Sep 28, 2021

yes, for all total cells.

Sebastian Morales commented on Sep 28, 2021

I meant what is the valueof the href link is and where do you get the link value?

Finu commented on Sep 28, 2021

help me solve it.

Finu commented on Sep 28, 2021

I intend to make it like this.

->pipe(new Pivot(array(
                'dimensions'=>array(
                   'row'=>'Type_Rank,Name_Rank',
                ),
                'aggregates'=>array(
                    <a href=''item.php?name=@value''>'+ DSP_O, Riil_O, Perc_O, DSP_N, Riil_N, Perc_N, DSP_Total, Riil_Total, Perc_Total +'</a>    
                    //'sum'=>'DSP_O, Riil_O, Perc_O, DSP_N, Riil_N, Perc_N, DSP_Total, Riil_Total, Perc_Total',
                )
            )))
Finu commented on Sep 28, 2021

Hello David Winterburn, KoolReport, and Sebastian Morales, can you guys help me out?

Sebastian Morales commented on Sep 29, 2021

Pls try to use the "map" property of PivotTable for creating the links:

//MyReport.view.php
PivotTable::create(array(
    ...
    "map" => array(
        "dataCell" =>  => function ($value, $cellInfo) {
            return "<a href='item.php?name=$value'>";
        }
    ),
));

Let us know if it works for your case or not. Tks,

Finu commented on Sep 30, 2021

Thanks a lot, Sebastian, this worked.

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
solved

Pivot