I have a field that shows the duration between 2 time intervals.

I have a view with a list of these time intervals.

I want to have the sum of these time intervals in the footer of the view.

I have tried:

<?php 
$sum = 0;
foreach($results as $key=>$value){
      $sum+= $value->views_field_view_view_1;
}
echo $sum;
?>

and the result is 0.

Help!?

Comments

esquareddesign created an issue. See original summary.

saurabh.dhariwal’s picture

For solving this use below code:

        <?php
        $sum = 0;
        foreach($results as $key=>$value){
              $sum+= $value->field_field_number[0]['raw']['value'];
        }
        echo $sum;
        ?>

Hope it helps you.

Thanks!

fizk’s picture

Status: Active » Fixed

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.

saurabh.dhariwal’s picture

Thanks for accepting my solution. Feel free to contact me regarding any Drupal issues/assistance.

Ready to help always :)