0

I have some views that use pivot tables. Their purpose is to display an attribute (for example, the gender) and a year value (for example, the birth year), using a third field named ID. The gender is used as pivot row and the birth year as pivot column. ID has the Aggregation type "Count". Additionally, we have a Total column for the row aggregate (number of values in Pivot settings) that counts how many people have a specific gender.

In this table, it's possible for a listed person to have an unknown year of birth. Therefore, I set the No results behavior for Birth year to unknown. That value is correctly shown as just another column.

Now I have a problem: Drupal doesn't count the row with unknown as birth year. It seems that it puts 1 inside the cell for female + unknown if there is one or more people with female as gender and unknown as birth year (no results behavior), but it doesn't count them.

Anyone has any hint on where I can determine how Drupal pivot tables work with No results behavior?

Edit @apaderno: In my opinion, this is not a request for documentation, but a question about a possible bug or at least bug-like behavior in the Drupal GUI. The phrasing "Anybody has any hint" may seem vague, but I had some positive experiences with that on other Stackexchange sites in the network, as it encouraged users to add their knowledge to the thread, even if it wasn't a complete answer to the question. I got some valuable hints this way in the past.

Edit2: When I change the Aggregation setting of the ID field to "Count Distinct", the No results behavior is counted correctly, but the row aggregate (as well as column aggregate) stops working correctly.

1
  • Anyone has any hint on where I can determine how Drupal pivot tables work with No results behavior? seems a request for documentation, which is off-topic for us. If the question isn't about that, please edit it to make it clearer. Bear in mind that questions like Did anybody get the same problem? are too broad to be acceptable.
    – avpaderno
    Commented Dec 12, 2021 at 8:45

1 Answer 1

0

It seems that this problem didn't occur only with No Results Behavior but with any value above 1 (being reduced to 1).

I solved the problem by adding the ID field as a Sort Criteria in the Drupal view. (The other fields stay without Aggregation, that is, the default value "Group Results By". In the Pivot settings, I kept the Row Aggregate of the ID field being "number of values".)

I have no idea how/why the Sort Criteria could possibly effect the counting results of the Pivot table, but they did.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.