If I use the settings within a table display to put more than one field into a column, if one of the fields is of integer type and has a value of 0, the field fails to display or even rewrite. The other field will show, but the zero valued integer field will not.

If I place the same field in its own column, it shows correctly.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

PapaGrande’s picture

I found the same issue too. Did you ever find a solution?

Train’s picture

I excluded the integer field from display and then re-wrote another field (of different type) to contain the combined values.

In the end it achieves the same results, but the original issue still isn't working correctly. Maybe it's using !empty v isset, dunno...

bkat’s picture

This code in theme.inc is what is causing the problem

        // Place the field into the column, along with an optional separator.
        if (!empty($vars['rows'][$num][$column])) {
            if (!empty($options['info'][$column]['separator'])) {
                $vars['rows'][$num][$column] .= filter_xss_admin($options['info'][$column]['separator']);
          }
        }
        else {
          $vars['rows'][$num][$column] = '';
        }

In my case I have three columns that are separated by a period. When the first column is 0, $vars['rows'][$num][$column] will have the value 0. Then the next column comes around to add its value, the first empty() call is returning true so we hit the else branch and clear the field.

I added a couple tests to check for values equal to '0'. Patch included for 7.x-3.7+24-dev.

bkat’s picture

Here's a new patch rolled against views-7.x.3.13. Can someone please post this or an equivalent? Its getting to be a pain constantly having to repatch this.

bkat’s picture

Version: 7.x-3.7 » 7.x-3.13

Reassigning the version since this still exists on the latest release (7.x-3.13) and the patch I just posted is against that version.

bkat’s picture

Status: Active » Needs review

The last submitted patch, 3: views_combined_fields.patch, failed testing.

The last submitted patch, 3: views_combined_fields.patch, failed testing.

The last submitted patch, 3: views_combined_fields.patch, failed testing.

The last submitted patch, 3: views_combined_fields.patch, failed testing.

Status: Needs review » Needs work

The last submitted patch, 4: views-fields-zero.patch, failed testing.

The last submitted patch, 4: views-fields-zero.patch, failed testing.

The last submitted patch, 4: views-fields-zero.patch, failed testing.

The last submitted patch, 4: views-fields-zero.patch, failed testing.

Train’s picture

So is this getting reviewed? Added?

A simple issue going on over two years now.

delacosta456’s picture

hi

Please is there any solution?
This looks to also happens when aggregating values of a colomn ... with sum fucntion ... an empty value is always returned..

any help ?

rickharington’s picture

Hi everyone

So after many a post, I finally found the topic where my problem is actually discussed only to find that it's still a problem 6 years on.

I'm trying to create an analytics platform but if the aggregated result is 0 then nothing shows.

Has this been fixed or am I somehow missing something?