I'm setting up a registration system for a conference, and I need a feature where people indicate whether they will participate in meals or not. I've added the requisite fields (checkboxes, with keys of Yes/No) to the registration form, and am now trying to build a view for the conference planners that counts the # of "Yes" answers for all the meals and displays that in a list.
I can add the fields to the view, and have just learned enough of the new aggregation settings to implement a COUNT on each field. But that gives me the total number of submissions in each field. What I can't figure out is how to add the condition to that count that this field must have the value of "Yes" in order to be counted.
I know I can do this if I were just using one field in a given display - I'd just add a filter. I suppose I could "hack" it by just adding multiple attachment displays with one field each and the appropriate filter (now that we can clone displays, it wouldn't be that much work). It just seems like that's not the ideal way.
What I'd like is to add all the fields (one per meal) within one view page display. It seems like the aggregation settings should be where I set the condition, but I'm not seeing it. So either my ninja-ness isn't up to snuff (which is true in general) or this just isn't possible right now.
I'm not sure that adding the view here will be helpful in this case. But the concrete example of what I'm trying to do might be helpful...
Let's say the conference has 100 registrations. Each meal is a field with a Yes/No checkbox. I want to display the # of Yes values for each meal. So if 80 people said Yes to each meal, the list should look like this:
Meal 1: 80
Meal 2: 80
Meal 3: 80
What I'm currently able to produce is:
Meal 1: 100
Meal 2: 100
Meal 3: 100
Any guidance/insight/pointing to other issues/solutions would be helpful. I've searched, looked at docs, checked out views_calc, but am coming up empty.
Thanks in advance.
Drupal 7.7
CTools 7.x-1.0-rc1
Views 7.x-3.0-rc1
Comments
Comment #1
merlinofchaos commentedViews does not support such a condition, and I'm not sure it would really be possible to. Perhaps you want a SUM which, if the values are stored as 0 for no and 1 for yes, could add up the number of YES votes.
You could also simply add a filter to exclude no votes, but that might have broader implications.
Comment #2
michaelschutz commentedThanks, Earl, that's what I figured. Re: the broader implications, that's it exactly. I can't really add filters, because the and/or issues are too complex - you can't exclude "no" on every meal with and/or logic because there's every possible combination of yes and no for each registrant.
I'll play with the SUM approach - that may be a good way to do it. If that doesn't work, I think I will need to just include multiple displays each with one meal field, and glue them together to display on one page for the planning team.
Thanks for the reply.
Comment #3
windmaomao commentedI wonder if there's a views field which will write a SQL like the following,
this way, we can just use SUM approach, since most of the fields are not in boolean format.