I have a view that has a relationship to a Field Collection field.
When trying to add the fields I can not get the fields in the field collection and the relationship does not show in the filter (only Bulk Operations and Content).

I have a different site with essentially the same node with the same field collection using Views 7.x-3.6 where it works fine. On this new site I have Views 7.x-3.7 and there it does not work.

When I look at the exported view I can see the relationship added like with the 7.x-3.6 version.

Comments

Max-III’s picture

Category: support » bug

It seems that none of the relations are working. I also use Profile2 and there I have the same problem; I can add the relationship but not the fields.

I've changed this to a bug report, I really can't see what I could be doing wrong.

Max-III’s picture

I'll just keep updating, maybe it helps...

There are other views in the site that have been created with relations. When created they worked fine. At the moment even the fields that are already added can't be found anymore.

I don't get any errors in view, can't find anything in the logs or reports.

What could possibly cause this?

Max-III’s picture

I've tried exporting a view that is working and importing it again but the result is the same. The fields added using a relationship are there and working but I still cannot add new fields or find the already added fields using the filter.

Max-III’s picture

I have created a new view and now I get these errors:

Notice: Undefined variable: table in ViewsUiBaseViewsWizard->default_display_filters_user() (line 684 of /var/www/vhosts/domain.com/subdomains/subdomainname/httpdocs/sites/all/modules/views/plugins/views_wizard/views_ui_base_views_wizard.class.php).

Most vexing, this.

Max-III’s picture

OK, I think I've found it. I disabled the Location module (7.x-3.0-alpha8+1-dev) and that seems to have fixed it. I guess I better notify them as well.

Max-III’s picture

Guess not...
The issue came back.

After disabling the location module all was working fine for a while and then all of a sudden it's the same thing again. One moment I'm happily creating views with relationships and the next the relationships are not working anymore.

Is there a safe way to go back to the previous version without losing the created views?

Max-III’s picture

This is getting worse and worse, now it can't even find the fields anymore.

I created a new view, added fields of the node type (which it found just fine) and saved it.
When I then tried to add a new field it can't find it in the filter. The fields already added (and displaying) can't be found anymore either.

Why did I chose Drupal for this project....

merlinofchaos’s picture

If disabling a module made the fields come back, they probably came back due to a cache clear.

That suggests that there's something that breaks the field data cache in a weird way.

You can probably work around the problem by going into the Views settings and choosing to disable the views data cache. That isn't a great workaround because it will impact performance, but it should allow you to get back to working on your Views.

I've seen this reported in a couple of different ways. Unfortunately, we don't have any really good ideas what actually causes this to happen. Usually it's some module relying on Views at a point where the system is only partially booted, causing important hooks not to fire, but this could be something new and unexpected as well.

Max-III’s picture

And you also showed why I chose Drupal :)

Yes, disabling the Views cache did indeed solve the problem as you described. I can continue to build the site, which is good, and then hope that somebody clever can provide a more sustainable solution. I think economists refer to that as a bubble... Still, better than it was.

There was some odd behavior with existing views; I could find and add the fields and also Field Collection fields using relationships but they did not display. Creating a new view worked just fine.

I guess this also means that the Location module is completely innocent which is also good news since I need something like that and I actually like the module.

I have not seen any other reports of this kind (and I looked, believe me) so if anybody happens to have any links to similar issues that might be helpful.

For this site almost everything depends on Views and there are a lot of modules. I hope I can find the module since going live with Views caching turned off is far from ideal.

Thanks Merlin!

Taxoman’s picture

You only had to turn off the Views cache for that one view, or views that are interfacing with Field Collation fields, and not all (other) views as well, right?
May this be related to using Profile2 fields (with Field Collation) in Views?

GeertWil’s picture

Maybe I'm pointing you in a wrong direction, but I had a very similar behavior on my site.
I could fix it by unabling the hierarchical_select_taxonomy_views module.
On my live site hierarchical select was not installed, on my test site it was.
The exported views from both sites were identical, but the generated SQL commands were not.
On my live site the SELECT part also gathered the taxonomy name and on my local test site the hierarchical select taxonomy views module seems to have prevented this name field to be collected.

Max-III’s picture

I have switched off caching for views entirely. The issue did not just occur with views using Profile2 fields but with just about everything, including creating new views. With caching off I can at least continue to build the site. I don't know yet how I will deal with this issue once the site is finished.

Max-III’s picture

I am currently not using Hierarchical Select. The only module that I thought it was related to was Location but that turned out not to be the case.

aromka’s picture

Had the same issue, disabling views cache seems to fix this problem. Thanks.

waltercat’s picture

Wow! You saved my life! Have spent a total of 7 hours trying to figure this out. I am only having problems with building views. Once the views are built can I reenable the caching and will the views themselves display alright?

busla’s picture

I´m getting this error when I add a Registration view.

Max-III’s picture

@waltercat
That is what I am doing. It seems to work so far.

tritrivi’s picture

I am experiencing the same behavior that is described in this thread. I was able to set up a relationship in one of my views to a Field Collection and then I was able to reference those fields in my view. Works great. I tried to do the same for another View using a different Field Collection and I am unable to select any Field Collections from the "Add Relationship" button. Now when I go back to the original View, the View still works but none of the "Field collection item: xxxx" fields are available to be added. I tried changing the View caching settings but they are already set to 'None" for the View. Is there another place to set View caching settings? Maybe I'm missing something? Also has a long-term solution been found for this issue?

Yuri’s picture

Issue summary: View changes

I have a similar strange issue with field collections and views relationships.
In my case, a view includes a field through a relationship with a field collection. At first it appeared to work, then I switched from administrator to authenticated user and only some of the fields were rendering, completely random with no apparent logic behind it.
Even more strange: other views in the same page also started to lose fields here and there.
As soon as I remove the views relationship to the field collection, the views start to behave normally again.
Let me know if this sounds familiar...

Yuri’s picture

Priority: Normal » Major

I again have the same issue, now with another websites. Disabling views caching, does not solve this issue.
Using a view of field collection items, A relationship to a field collection field works fine for administrators but for other roles like authenticated users or anonymous users, the complete view is not showing, but does render the 'No results behavior' of the view. This sounds very much like a permission issue, but I have checked all permissions many times.

prsnjtbarman’s picture

I can not find 'Field Collection Item' option present in Filter Dropdown when trying 'Add relationships' in a Content-View.
Also getting below error in popup when trying to add the Relationship for the 'Field-Collection' field of that content-type.
"The handler for this item is broken or missing and cannot be used. If a module provided the handler and was disabled"