Issue with grouping in a view using Views PHP I posted this a week ago at the drupal.org issue queue for Views PHP, but have not received a single response, so I'm hoping someone here can help me.

I have a view that displays a conference schedule. Each session is associated with a track (taxonomy), and gets a track icon to display. There's also one or more speakers per session (entity references to the speaker nodes). There's one type of session that needs to be associated with all the track types, but we don't want it to have a visual indicator. In order to get the icon to display conditionally, I used a Global PHP field. It prints the icon (if the conditions are correct) and then the session number and title, all on a single line. This works. The view is grouped first by date/time, so all sessions on Wednesday at 10 AM show up under a single heading. This also works. Here's the output code of the Global PHP field:

&lt;?php
if(isset($data-&gt;field_field_hide_track[0]['raw']['value'])) {
    if($data-&gt;field_field_hide_track[0]['raw']['value'] == '0') {

    $image_vars = array(
        'path' =&gt; file_create_url($data-&gt;field_field_track_icon[0]["rendered"]["#item"]["uri"]),
        'alt' =&gt; $data-&gt;field_field_track_icon[0]["rendered"]["#item"]["alt"],
        'attributes' =&gt; array(
          'class' =&gt; array('session_list_track_logo')
        )
      );

    $track_logo = theme('image', $image_vars);
    print "&lt;h3&gt;" . $track_logo . " " . $data-&gt;field_field_session_number[0]['raw']['value'] . " | " . $row-&gt;title . "&lt;/h3&gt;";
    }
    else {
      print "&lt;h3&gt;" . $data-&gt;field_field_session_number[0]['raw']['value'] . " | " . $row-&gt;title . "&lt;/h3&gt;";
    }
}
?&gt;


Before adding the Global PHP, it was secondarily grouped by a dummy field that had its output rewritten to concatenate session number and session title. (both individual fields were hidden from display.) This worked, but we couldn't display the icon conditionally. 

That's where the Global PHP field comes in. If I group by date/time and then by the php field, it's inconsistent between session records. Sometimes it prints the php field twice, regardless of how many speakers there are. Sometimes it prints it once for each speaker. Sometimes it prints once for the first speaker, and a second time for the next chunk of speakers.



grouped by date/time and session number (both excluded from display); displaying php field




grouped by date/time and php field (both excluded from display




I've also tried grouping by all possible common fields (date/time, session number, session title, icon, and php field) which gives me such a mess I couldn't even get a decent screenshot of it because a single record doesn't fit on my screen!

This is the desired result:


I'm attaching screenshots of all of these, as well as a mockup shot of the desired result. Can anyone help me out? (Note that the groupBySessionNumber.png screenshot was taken after the Global PHP field was added, and the icon/number/title line is a result of that field.)
Consider using a Computed Field on the Session content type to combine


the icon  (conditionally) 
the session number 
the session title


Then you can use that field for the secondary sort, and leave the Global PHP out of the View. Be sure to store the computed field in the database so that Views can access it.