Using Views 6.x-2.5 and Location 6.x-3.1-rc1/6.x-3.x-dev. View can't get Location fields to include in the view. If I choose a Style: and Row Style that gets the entire node, then I can get the Location fields; if I choose a Style: and Row Style: that just gets particular fields, none of the Location fields can be retrieved, they just come up blank. Only Location fields are affected, that is, if I retrieve the node title and one of the Location fields, I get the node titles listed but nothing for the Location field.
This is probably just a coding/schema problem, maybe the Location module isn't announcing its fields correctly to Views??
Here's a field retrieval query, gets nothing:
SELECT node.nid AS nid,
location.province AS location_province,
location.country AS location_country
FROM node node
LEFT JOIN location_instance location_instance ON node.vid = location_instance.vid
LEFT JOIN location location ON location_instance.lid = location.lid
WHERE node.type in ('clinic')
(The result of the above query is a dataset with as many rows as there are clinic nodes, but no data.)
Here's a node retrieval query, successfully gets all node fields and displays the entire node's data including Location fields:
SELECT node.nid AS nid
FROM node node
WHERE node.type in ('clinic')
I just looked in my database to see what was going on, and the problem appears to be the location_instance table - the nid and vid fields in that table are always 0, which does not mesh with the node table. I don't understand what exactly you're using that table for, but you're populating it incorrectly, I think.
Comments
Comment #1
yesct commentedI suspect you are using cck locations? Post back, so we can know more how to help you.
See:
http://drupal.org/project/issues/search/location?text=&assigned=&submitt...
There are some hacks/patches dealing with the vid, and some other issues in the queue trying to implement a relation. Maybe someone who understand the relation thing can explain.
Comment #2
eljustino commentedI seem to have the same problem.
Using:
Location: 6.x-3.1-rc1
CCK: 6.x-2.2
Views: 6.x-2.5
And, as you mentioned, CCK locations.
The various Locations fields show up perfectly in a Node or a view with Style = unformatted and Row Style: Node, but if I select like a Table style or Row Style = Fields, I just get the label with no visible data.
Comment #3
eljustino commentedOk, when I don't use CCK Locations, I'm able to see the data in the fields in my view. A little confusing, but it works.
Comment #4
Enfirno commentedsubscribing
Comment #5
aaronelborg commentedsubscribing
Comment #6
ekes commentedWhen it's a location_cck field being pulled by views the whole location isn't loaded as would happen normally with CCK. The results of the query are thrown pretty much toward theme_location_cck_formatter_*() thus a theme function is getting the element #item
when it normally gets
I guess there is something in the definition of the view display that could solve this?
Or quick and dirty each location_cck theme function can load the location if it's not there yet. Possibly not efficient?
But I'm also thinking it's possibly better to make the user add a 'relationship' to the location table on the lid(s) - thus using the same 'location' displays made available for the non-cck location?
Comment #7
ekes commentedOK. Taking investigating the third idea above I see it's there already so this is a dupe of http://drupal.org/node/347030 and for this specific problem in dev, at least, fixed.
For this problem:-
From here I'd say it's a testing and documentation problem (it's not exactly the obvious thing to do ;)