Hi there,
Was pulling in values from the GroupBy and another field, to join together in a 3rd field, using replacement values:

SQL Aggregation value: 2
CustomField: Videos

Result of replacement patterns to join both SQL Aggregation and Customfield together:
[views_sql_groupedfields] [phpcode] = 'test Videos'

Turns out, on line 292 of views_groupby_handler_field_groupfields.inc, the function render shows up as:

function render($values) {
// dpm($values);
return 'test';
}

So of course this is rendering any replacement patterns of the field as 'test'..

Thanks!

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

alduya’s picture

Version: 6.x-1.0-rc2 » 6.x-1.x-dev
Status: Active » Needs review
FileSize
629 bytes

I created a patch that does return the correct value.
I reused code from the query function to retrieve the field that holds the aggregated data. This works for my use case (only 1 aggregating field), but I am not sure if this works for all cases.

-    // dpm($values);
-    return 'test';
+    $to_aggregate = $this->options['views_groupby_fields_to_aggregate'];
+    $to_aggregate = $this->_fix_settings_array($to_aggregate);
+    return $values->$to_aggregate[0];
alduya’s picture

Ok, so I noticed that it still didn't really work.
After digging a little deeper I now understand better how it works. The patch is not necessary.

It doesn't really matter what value is rendered because the aggregating field replaces the value of the FIELDS TO AGGREGATE WITH THE SQL FUNCTION field and does not output a value for itself.
If you want to use the replacement value of the aggregation, you have to use the FIELDS TO AGGREGATE WITH THE SQL FUNCTION field.
So in the example (http://drupal.org/node/389230) you would have to use [nid]