KoolReport's Forum

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

Table: field value in footer:top #120

Open bysystem opened this topic on on Sep 27, 2017 - 5 comments

bysystem commented on Sep 27, 2017

Dear support team,

in my following view code I've embedded a table with the "footer"=>"top" property:

					<?php
						if((isset($_POST["btnSubmit"])) AND ($this->dataStore("Table.Report_ABS")->countData()>0))
						{
							Table::create(array(
							  "dataStore"=>$this->dataStore('Table.Report_ABS'),
							  "showFooter"=>"top",
							  "columns"=>array(
								"ProductHierarchie",
								"ProductNumber",
								"LocalMaterialDescription",
								"BudgetAktuellerMonat"=>array(
									"label"=>"Budget<br />akt. Mnt.",
									"footer"=>"sum",
									"footerText"=>"<span style='font-size:150%;'><b>∑ @value</b></span>",
									"cssStyle"=>"text-align:right;font-weight:bold;font-size:120%;"							
								),
								"ErgebnisAktuellerMonat"=>array(
									"label"=>"Ergebnis<br />akt. Mnt.",
									"footer"=>"sum",
									"footerText"=>"<span style='font-size:150%;'><b>∑ @value</b></span>",
									"cssStyle"=>"text-align:right;font-weight:bold;font-size:120%;"								
								),	
								"BereitsFakturiertAktuellerMonat"=>array(
									"label"=>"Bereits fak.<br />akt. Mnt.",
									"footer"=>"sum",
									"footerText"=>"<span style='font-size:150%;'><b>∑ @value</b></span>",
									"cssStyle"=>"text-align:right;font-weight:bold;font-size:120%;"								
								),
								"BereitsFakturiertAktuelleWoche"=>array(
									"label"=>"Bereits fak.<br />akt. Wo.",
									"footer"=>"sum",
									"footerText"=>"<span style='font-size:150%;'><b>∑ @value</b></span>",
									"cssStyle"=>"text-align:right;font-weight:bold;font-size:120%;"								
								),
								"InLieferung"=>array(
									"label"=>"In<br />Lieferung",
									"footer"=>"sum",
									"footerText"=>"<span style='font-size:150%;'><b>∑ @value</b></span>",
									"cssStyle"=>"text-align:right;font-weight:bold;font-size:120%;"								
								),							
							  )
		
							));
						}
					?>  

The output is:

But I would like to hide the repeating first column values (DS EN 750) and put the distinc value (here: DS EN 750) in the same row as the footer like:

Any idea how to implement this?

KoolReport commented on Sep 27, 2017

You do this:

$product_hierachy = $this->dataStore("Table.Report_ABS")->get(0,"ProductHierarchie"); // Get the "DS EN 750"

Table::create(array(
    "columns"=>array(
        "ProductHierarchie"=>array(
            "formatValue"=>function($value)
            {
                return ""; //Make empty column on Table
            },
            "footerText"=>$product_hierachy,
            ...
        )
        ...
    )
))

Hope that helps.

bysystem commented on Sep 27, 2017

Great! The column "ProductHierarchie" is empty now.

But what I'm missing is the text "DS EN D750" in the footer row (or only 1 x in the column "ProductHierarchie")! Because otherwise the user does not know immediately for which product hierarchy the values in the table are. How to do this?

<?php

if((isset($_POST["btnSubmit"])) AND ($this->dataStore("Table.Report_ABS")->countData()>0))
{
	$product_hierachy = $this->dataStore("Table.Report_ABS")->get(0,"ProductHierarchie"); // Get the "DS EN 750"
	Table::create(array(
	  "dataStore"=>$this->dataStore('Table.Report_ABS'),
	  "showFooter"=>"top",
	  "columns"=>array(
		"ProductHierarchie"=>array(
			"formatValue"=>function($value)
			{
				return ""; //Make empty column on Table
			},
			"footerText"=>$product_hierachy,
		),
KoolReport commented on Sep 27, 2017

Alright, you do this:

$product_hierachy = $this->dataStore("Table.Report_ABS")->pop()["ProductHierarchie"];
bysystem commented on Sep 27, 2017

Yes sir! That's it!

Thx so much, u'r the best!!!

KoolReport commented on Sep 27, 2017

You are welcome :D

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

None