I am using the location module as a field so the user can enter a City and State when they add a project node. For some reason when I try to display the location as a view it won't show the location.

I am adding this as a field: Content: Location (field_project_location)

Shouldn't this mean that it will display anything added to the overall location field???? example: Long Branch, NJ

Nothing will display? am I filtering wrong? the only two filters that I have are "Published: Yes" and Node: "Type = project"

Comments

pbrough’s picture

I am also having this problem. I have been through the patches from here http://drupal.org/node/427432 and also tried to use the country code on its own.

The shows Node Title and the Country. But for a lot of nodes the country is blank.

A direct SQL query from the view also shows up a NULL in the country column. However none of the locations are NULL.

I know the filtering is not a problem as the country is exposed and some nodes do have a country listed.

dougm’s picture

I have a similar problem. None of my Location field values show up when I use Views to display the data in the content type.

All of the content have a Location field with value in it. If I look at the content it is there.If I tell views to use "nodes" rather than "fields", and use an unformatted display, then the Locations show up. If I use fields, and then look at what the SQL code returns, it does return valid ids for the Locations. They display as empty fields even though the SQL has a value for the field. Basically, it is always empty when using fields but I can get a value for nodes as long as it isn't one of the formatted forms. I can provide more info if needed.

rooby’s picture

Assigned: jtunney1 » Unassigned
Category: task » support

If you are using node locations or user locations then you can just use the "Location: whatever" fields and they will work.

If you are using a cck location field only the "Content: field_name" field will work (although not in 3.1, only in the current dev as it was fixed recently.

The user the "Location: whatever" fields you need to add a relationship to your view between the cck field and the location table and then when you use location fields make them use that relationship.
The relationship you need is a content relationship and will be called "Content: field_name" where field_name is the name of your field.

I hope to document all this properly sometime soon as this is a common question.

Does that fix your problem?

dougm’s picture

It didn't resolve my problem. I may be misunderstanding what your fix is.
I added a relationship on the view for the Location: <> field and that didn't change
anything. I can send you a login if looking at it yourself would help.

Thanks,
Doug

rooby’s picture

Sorry, maybe I misunderstood your post.

If you are using the "Location: whatever" fields you need the relationship but if you are using the "Content: field_name" field you don't need to.

If you are using the "Content: field_name" field then you problem is probably that there was a bug causing this to not work, which was fixed in this issue - #427432: RTBC Content: Location views field always blank very recently.

So for that you will have to use the 6.x-3.x-dev version instead of the 6.x-3.1 version.

If you still can't get it to work after that can you paste an export of your view into a text file and post it here.

dougm’s picture

The dev version solved my problem! thank you.

rooby’s picture

Status: Active » Fixed

Cool, the original poster's problem seems to be the same but they can re-open if their problem persists with the dev version.

Status: Fixed » Closed (fixed)

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