I watched over all issues about Field collection and Views, and I didn't find the same, so excuse me if i open a new one.

I've a serious problem using Views with exposed filters, to display content with a field_collection including one taxonomy term reference. Users can insert more instances of the term reference.

I need a view to list all documents of that type, and a filter to narrow the listing to only documents contaning, in the field collection, given terms.

For example, I have:
- node 1-->
field_collection 1-->instance 1: term A
instance 2: term B,
instance 3: term C
- node 2-->the same, with terms A, B
- node 3-->the same, with terms B, C

I created the view, also created the proper relationships, and the exposed filter works fine if I use an "is one of" operator: if I filter to see who has A, or C, i get node 1, 3. If i ask for B and C, i get node 1, 2, 3

But if i use the "is all of" operator, i have some problem: if i ask for A and B... i get nothing. I should have node 1 and 2...

Note that this normally works when using taxonomy term reference fields that are not in a field collection. So it's not a problem of views filter itself. Any idea to find where's the problem?

PS: this happens using Field Collection 7.x-1.beta-4.

I tried using beta-5 and I have a sort of loop, maximum execution time exceeded, and:

PDOException: SQLSTATE[23000]: Integrity constraint violation: 1048 Column 'uid' cannot be null: UPDATE {sessions} SET uid=:db_update_placeholder_0, cache=:db_update_placeholder_1, hostname=:db_update_placeholder_2, session=:db_update_placeholder_3, timestamp=:db_update_placeholder_4 WHERE ( (sid = :db_condition_placeholder_0) AND (ssid = :db_condition_placeholder_1) ); Array ( [:db_update_placeholder_0] => [:db_update_placeholder_1] => 0 [:db_update_placeholder_2] => 127.0.0.1 [:db_update_placeholder_3] => batches|a:1:{i:22;b:1;}updates_remaining|a:0:{} [:db_update_placeholder_4] => 1358589848 [:db_condition_placeholder_0] => KFuan9WrJ2Q0DmUbqAI0hx6EOeCZqMZ45ORhcld-ihg [:db_condition_placeholder_1] => ) in _drupal_session_write() (line 209 of D:\Apache22\htdocs\donnecv\includes\session.inc).

And again, using -dev still the exceeded time (but no more the pdoexception).

I reverted to beta4 and will use the "is one of" operator. But I will appreciate every help with this issue...

Thanks in advance

Comments

francoud’s picture

nobody can help? :(

Stephen Ollman’s picture

BUMP...I'm having the exact same issue.

It's nice to know it's not just me. I'm also using a field collection multi term item when exposed

I have a taxonomy group,

Banana
Apple
Orange

I have a node that is assigned both Banana and Orange via a field collection term item.

In my view I have an exposed filter set against the field collection item using a relationship of the field group and I'm using 'is all of' as I want users to be able to filter down to an exact match.

So if I expose filter Banana only I get the node.

If I expose filter Orange only I get the node.

However if I expose filter Banana AND Orange I get nothing.

Any thoughts as to why?

I can obviously use 'is one of' that that gives a very loose criteria and any node with Banana or Orange will be displayed, but that's not the required result.

Stephen Ollman’s picture

Is it at all possible to determine if this is a Field Collection issue or a Views Issue?

rewerz’s picture

anyone? I have exactly the same problem.

shawnmatthews’s picture

Has anyone found a solution for this? I'm having the same exact problem. I've run several tests and my thought is that the issue is originating out of the way that field collections is passing in the information of the first field type. If I use the "if one of" it works perfectly and I can look up using one field or the other (if you look at the SQL query this uses an "IN" statement and both are technically in position 0 even though it's not listed). When I try to use "is all of" it appears that the first field is assigned to position 0 in the query and the second which is technically the same field (different value of course) is being pulled from position 1. So if you only enter one value using the "if all of" operator it works because it pulls the value from position 0, but if you enter two values the second value is being pulled from a position where it simply doesn't exist, and therefore causing zero results to display. Happy to share my findings with anyone. Hopefully someone came up with a solution and hasn't reported back yet.

shawnmatthews’s picture

Hi All,

I have a solution that's a bit of a work around, but seems to work fine in a similar situation using fields instead of taxonomy. I ended up using the same relationship multiple times and increasing the delta value by 1 with each new relationship which pulled in each option in the subcategory. I then grouped the fields and used a combine filter (should also work for taxonomy) to run the "is all of" search. Seems to work great and isn't overly resource intensive. This will give you a 1 to 1 result based on whatever is in the the field collection field item you build the relationship off of.

Hope this helps.

Best,
Shawn