KoolReport's Forum

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

How to strikethrough certain rows on a table #2908

Open Richb201 opened this topic on on Dec 18, 2022 - 8 comments

Richb201 commented on Dec 18, 2022

Here is my table:

I'd like to put a strikethrough on a few of the footers such as Total qualified wages for IOS. I also don't want to include it in the sum: Total qualified wages for all Business Components: {sumAmount} at the bottom of the table. The fact that these certain rows need to be cross-throughed comes from another datastore, business_components.

Bottom line is that I still want to show these amounts to the reader so that they can see that the Business Component and the amount was considered, but not included. But I will settle for just setting the amount to zero. So I am looking at two custom footers: one for the group and one for the entire table.

I have another datastore called business_components which contains each bus_comp and field called not_qualified. There are about 5 rows.

In your custom footer example you use this:

"footer"=>function($store)
                {
                    return "$".number_format($store->sum("amount"));
                },

I'd like to use: ` "footer"=> function($business_components)

                {
                  if($business_components->not_qualified==1)
                      return 0;
                },

I then tried "footer"=> function($business_components)

                {
                  if($business_components->bus_comp[not_qualified]==1)
                      return 0;
                },
But this didn't work either. I could do this in sql but don't seem to have that ability on a row by row basis. 


.strikethrough {
    text-decoration: line-through;
}

Please tell me how to modify the group footer.
Richb201 commented on Dec 18, 2022

I see how to format a column. But how to format a row (or a grouping)?




"income"=>array(
                "formatValue"=>function($value,$row)
                {
                    $color = $value>70000?"#718c00":"#e83e8c";
                    return "<span style='color:$color'>$".number_format($value)."</span>";
                }    
            )

I want to format it as a strikethrough. I also want to ignore strikethroughs in the footer sum().

Sebastian Morales commented on Dec 19, 2022

On which conditions do you want to style strike-through a row?

Richb201 commented on Dec 19, 2022

Hi. I have another table that has the name of the bus_comp and a column called not_qualified. If not_qualified =1 then I want to strike through the "calculate".

Richb201 commented on Dec 19, 2022

how can I address only specific

"calculate"=>array(
                        "{sumAmount}"=>array("sum","total_amount"),
                    ),

Is there some type of if then I can use? Can I use a value in the record in the datastore to either strikethrough or not?

Richb201 commented on Dec 21, 2022

Two days ago you asked: On which conditions do you want to style strike-through a row? I can easily modify a field in the table to hold that. No problem. I figured out how to get a strikethrough. <del></del> BUT!!! How can I get a strikethrough for a specific row? If it can't be done, let me know. I will figure out a different path.

"grouping"=>array(
                "item"=>array(
                    "calculate"=>array(
                        "{sumAmount}"=>array("sum","dollarsPerBC"),
                    ),

                    "cssStyle"=>"text-align:right",
                    "bottom"=>"<td colspan='6 style='text-align: right'><b>Total wages for : {item}</b></td><td style='text-align: right'><b>{sumAmount}</b></td><br>",

                ),
            ),

Can I do something like this?


if (valid==1){
"bottom"=>"<td colspan='6 style='text-align: right'><b>Total wages for : {item}</b></td><td style='text-align: right'><b>{sumAmount}</b></td><br>"
}
else
{
"bottom"=>"<td colspan='6 style='text-align: right'><b>Total wages for : {item}</b></td><td style='text-align: right'><del>{sumAmount}</del></td><br>"
}

Richb201 commented on Dec 23, 2022

Well after 5 days of no response i am wondering about priority support? The docs are fairly non existent.

If koolreport can't do what I need, just say so. I am a grownup, I can handle it.

Richb201 commented on Dec 23, 2022

Just to reiterate what i am trying to do, I have this in a report:

"grouping"=>array(
                "item"=>array(
                    "calculate"=>array(
                        "{sumAmount}"=>array("sum","dollarsPerBC"),
                    ),

                    "cssStyle"=>"text-align:right",
                    "bottom"=>"<td colspan='6 style='text-align: right'><b>Total wages for : {item}</b></td><td style='text-align: right'><b>{sumAmount}</b></td><br>",

                ),
            ),

I'd like to set sumAmount to zero for some of the groups.

Sebastian Morales commented on Dec 29, 2022

Sorry for missing this topic for the last few days. Regarding your last question, your Table's group top or bottom could be a function instead of a string:

"grouping"=>array(
                "item"=>array(
                    "calculate"=>array(
                        "{sumAmount}"=>array("sum","dollarsPerBC"),
                    ),

                    "cssStyle"=>"text-align:right",
                    "bottom"=>function($groupValues) {
                        echo "groupValues = "; var_dump($groupValues); echo "<br>";
                        return ...;
                    },

                ),
            ), 

Depending on $groupValues you can customize the returned group string to your need.

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