Score:2

Views aggregation of content values across two columns

us flag

I have a test content type that has a test name (A or B) and whether the Test is a pre-test or a post-test. Given the following data from that content type:

Test Type
A Pre
A Pre
A Post
B Pre
B Post
B Post

I am able to use Views aggregation to get the total number of each Survey, or total by type across two rows:

Survey Type Total
A Pre 2
A Post 1

But I am trying to use views to aggregate the data so that it shows the total number of pre-tests and post tests for each Survey to look something like:

Survey Pre Post
A 2 1
B 1 2

Any ideas or direction on whether this is possible using Views Aggregate or another Views add-on module?

Score:1
gb flag

You can try to do this with the Views Aggregator Plus Module (https://www.drupal.org/project/views_aggregator).

Try the following steps to achieve your goal:

  1. Install the views_aggregator module.

  2. Create the basic table and add a second "Type" column. Name the first one "Pre" and the second one "Post". Don't use the default aggregation. The table should than look like this:

Test Pre Post A Pre Pre A Pre Pre A Post Post B Pre Pre B Post Post B Post Post
  1. Select as format the "Table with aggregation options".
  2. Use for the "Test" column the "Apply group function" with "Group and compress". For the "Pre" column the "Apply group function" with "Count (having regexp)" and as Parameter "Pre" and for the "Post" column the same with the parameter "Post".
  3. After saving your table should look like expected.
I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.