A simple scenario. Content Type "Topic" has a text field "Category" which is a simple multi-select field that can have unlimited values (more than 1). So a topic can have 2 or more categories.
Then in my view I display all "topic" nodes. I want an exposed filter to let me filter by category, but be limited by the result set. No matter which direction I take, I cannot accomplish this.
It seems that the filter cannot pull any values out of a grouped limiting field, and this is the root of the problem.
Option #1: This is the one that should work.
Distinct: No
Field: Category: Group Multiple Values: Yes
Filter: Use field_category as limiter
Result: View rows display as expected, filter only contains . Fail
Option #2:
Distinct: No
Field: Category: Group Multiple Values: No
Filter: Use field_category as limiter
Result: View rows are duplicated for each category. Filter displays properly. Fail
Option #3:
Distinct: No
Field: Category: Group Multiple Values: Yes
Filter: Use default as limiter
Result: View rows display as expected. Filter contains values that exist in previous versions of node. Fail
Option #4:
Distinct: Yes
Field: Category: Group Multiple Values: No
Filter: Use default as limiter
Result: View rows display as expected. Filter contains values that exist in previous versions of node. Fail
Option #5:
Distinct: Yes
Field: Category: Group Multiple Values: No
Filter: Use field_category as limiter
Result: View rows display as expected. Filter only contains first value for category. Fail
Comments
Comment #1
terbs CreditAttribution: terbs commentedMy bad, I'm actually using the dev version
Comment #2
terbs CreditAttribution: terbs commentedI feel a solution coming on ;)
Comment #3
xl_cheese CreditAttribution: xl_cheese commentedYou're not alone. I have the exact same behavior. I'm pretty sure the developer is working on making the limiting work with distinct set to yes.
Comment #4
Steven Monetti CreditAttribution: Steven Monetti commentedAfter hours of work with Brent Hartmann we got the solution:
right before (around line 70)
Comment #5
terbs CreditAttribution: terbs commentedHere's a rundown of the above solution . . .
The default behavior of the module is to determine the result set via cloning the view and going through each row to see the value of the fields.
When fields are grouped, 1. they don't create a new row, and 2. they don't even show up in the view object.
So the way this solution works is by removing grouping and distinct from the clone, letting each field produce a new row, thereby allowing the rest of the program to run normally, parsing out the values.
Comment #6
xl_cheese CreditAttribution: xl_cheese commentedThat was quick!
Can you explain the proper configuration to make this work? Is it one of the options that the OP laid out above?
Comment #7
terbs CreditAttribution: terbs commentedIt should satisfy a few of them actually
With this patch you should be able to use distinct -and- grouping while maintaining accurate limiting. It's only been tested when an actual limiting field has been selected for the filter options (not using default).
Comment #8
infojunkieThanks for the in-depth analysis and the code fix!
I committed this fix, along with another to solve the default handling that incorrectly grabbed values from earlier revisions.
I'd be grateful if the 5 options in the OP could be tested against the latest dev release (12 hours from now or from CVS).
Comment #9
xl_cheese CreditAttribution: xl_cheese commentedComment #10
xl_cheese CreditAttribution: xl_cheese commentedplease disregard my note. I accidentally used the wrong module I had leftover on my computer. :P