Early Bird Registration for DrupalCon Portland 2024 is open! Register by 23:59 UTC on 18 March 2024, to get $100 off your ticket.
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!
Comment | File | Size | Author |
---|---|---|---|
#1 | views_groupby_replacement_values_821858_2.patch | 629 bytes | alduya |
Comments
Comment #1
alduya CreditAttribution: alduya commentedI 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.
Comment #2
alduya CreditAttribution: alduya commentedOk, 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]