Page 1 of 1

Report totals

Posted: Wed Mar 06, 2024 2:19 am
by daveb

I have several reports that contain a decimal number that represents minutes, which I use cell_rendering or page_rendering to covert the view value into HH:mm . However, this function is not activated in the sub total and total rows - they simply show SUM=12345 . Is there a way to apply the same formatting to the total lines? BTW I would also like to change the SUM= and COUNT= lables.

Thanks

Davod


Re: Report totals

Posted: Wed Mar 06, 2024 9:45 am
by mobhar

You may post your code in that Cell_Rendering or Page_Rendering server event for more discussion.


Re: Report totals

Posted: Thu Mar 07, 2024 6:07 am
by daveb

I have placed this code in Row_Rendered and it works fine in List pages and in Report detail rows :

 $h = floor($this->Flight_Time->CurrentValue/60);
 $m = 100 + ($this->Flight_Time->CurrentValue - ($h * 60));    // force leading zero on minutes
 $this->Flight_Time->ViewValue = $h . ":" . substr($m,1,2);

It also works in Summary items on the List pages, but does not work on Report summary rows, so I added:

    if ($Field->Name== 'Tow_Time')
   {
    $h = floor($CurrentValue/60);
    $m = 100 + ($CurrentValue - ($h * 60));    // force leading zero on minutes
    $this->ViewValue = $h . ":" . substr($m,1,2);
    }

in Cell_Rendered for the report, but there is no change.

If possible, I would also like to change the labels +SUM=", COUNT=" etc. in the summary lines.


Re: Report totals

Posted: Thu Mar 07, 2024 11:17 am
by arbei

daveb wrote:

$this->ViewValue = $h . ":" . substr($m,1,2);

There is no $this->ViewValue, you need to use the arguments of the Cell_Rendered server event.


Re: Report totals

Posted: Fri Mar 08, 2024 2:50 am
by daveb

Correctred the code - It gives me correctly calculated times in HH:mm.

  if ($Field->Name== 'Tow_Time')
   {
    $h = floor($CurrentValue/60);
    $m = 100 + ($CurrentValue - ($h * 60));    // force leading zero on minutes
    $ViewValue = $h . ":" . substr($m,1,2);
    }

Thanks

David