In crosstab reports I am showing SUM values.
I would like also like to show average but only at the bottom, not for all cross sections.
So I would most likely select SUM and AVG in crosstab / Value and select to show grand summary.But how to NOT show AVG on the individual lines and NOT show SUM in grand summary.tia
/Poul
Have now tried this in Cell_rendered event:
if ($this->RowType == ROWTYPE_DETAIL) {
if ($smry->SummaryType == "AVG") {
$ViewValue = "";
}
}
but still no joy.Any suggestions most welcome./Poul
marisoft wrote:
if ($smry->SummaryType == “AVG”) {
$ViewValue = “”;
}
I assume you did not post your complete code, otherwise there is no $smry in your server event.You better debug your code by echoing the values first, e.g.
var_dump($this->RowType, ROWTYPE_DETAIL, $smry);
The alternative way may be to hide the values by CSS, you may read Inspect HTML element and add your own CSS styles.
Suggested var_dump gives a bunch of these:
int(8) int(8) NULL int(8) int(8) NULL int(8) int(8) NULL
So I probably cannot detect that this is a AVG value that I want to dismiss and I cannot see how I can apply CSS either in this case.I actually find it strange that the AVG value is shown here in the first place./Poul
marisoft wrote:
Suggested var_dump gives a bunch of these:
int(8) int(8) NULL int(8) int(8) NULL int(8) int(8) NULL >
That shows you that your server event was called 3 times, $this->RowType = 8, ROWTYPE_DETAIL = 8, but $smry is NULL. As said:arbei wrote:
I assume you did not post your complete code, otherwise there is no $smry in your server event.
Hi again,You are right about $smry not being set anywhere.I have late yesterday asked at PHPmaker support, and got this answer:
What is $smry? It is not set anywhere at all. If you want to get the summary type, you need to set the $smry first, e.g.
var_dump($this->SummaryFields); // View $this->SummaryFields first, $this->SummaryFields is an array, find the summary field you want to check
$smry = &$this->SummaryFields[$i]; // Set $smry as one of the array item (the one you want)
In the crosstab report AVG values are shown together with the SUM in the detail. (I want) the AVG value only be shown in the total line.Anyway I tried coding around this in Cell_Rendered event and it probably should be done in Row_Rendered event.But it turns out that the SummaryType is actually AVG for both the sum amount and for the average amount as revealed by below code in Row_Rendered event:
$cnt = count($this->SummaryFields);
for ($is = 0; $is < $cnt; $is++) {
$smry = &$this->SummaryFields[$is];
$scvcnt = count($smry->SummaryCurrentValues);
for ($i = 0; $i < $scvcnt; $i++) {
$this->CurrentIndex = $i;
if ($smry->SummaryType[$i] == "AVG") {
var_dump("AVG"." ".$currentValue);
$currentValue = $smry->SummaryCurrentValues[$i];
var_dump("AVG"." ".$currentValue);
} else {
$currentValue = "";
var_dump("No AVG");
}
}
}
Brgds,
/Poul
You wrongly used index for $smry->SummaryType (which is not array) in your code, marisoft wrote:
if ($smry->SummaryType[$i] == “AVG”) {
arbei wrote:
You better debug your code by echoing the values first, e.g.
var_dump(…, $smry);
>