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

yesct’s picture

Status: Active » Postponed (maintainer needs more info)

I 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.

eljustino’s picture

Version: 6.x-3.x-dev » 6.x-3.1-rc1

I 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.

eljustino’s picture

Ok, 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.

Enfirno’s picture

subscribing

aaronelborg’s picture

subscribing

ekes’s picture

When 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

array(2) {
  ["lid"]=>
  string(4) "1281"
  ["#delta"]=>
  int(0)
}

when it normally gets

array(15) {
  ["lid"]=>
  string(3) "123"
  ["name"]=>
  string(0) ""
  ["street"]=>
  string(0) ""
  ["additional"]=>
  string(0) ""
  ["city"]=>
  string(7) "Utrecht"
.... etc ...

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?

ekes’s picture

Version: 6.x-3.1-rc1 » 6.x-3.x-dev
Status: Postponed (maintainer needs more info) » Fixed
Issue tags: +location cck

OK. 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:-

  1. Make a 'relationship' on the CCK field that you want to be the location
  2. Then in 'fields' choose the 'location' fields you want NOT the content_ ones
  3. In the options for the location 'field' you can choose the relationship to be the one from the location cck field you made at the start

From here I'd say it's a testing and documentation problem (it's not exactly the obvious thing to do ;)

Status: Fixed » Closed (fixed)
Issue tags: -location cck

Automatically closed -- issue fixed for 2 weeks with no activity.