Hi everyone:

I'm working on a project that just use views and CCK. I have one new content type CCK with one field of type Location.

Everything is fine if I preview the content but If I use the view cant see any of the Location Info
If I see the node wheres is the data, everything is fine too..

But when I use the views I can't get any info from the Location. I've been searching for hours but I didn't find any solution. I put all the permissions, I'm sure i put the data to be displayed. But when i'm trying to display by views no data about Location is possible.

Anyone has any idea?

Comments

nahuelsgk’s picture

Status: Active » Closed (fixed)

Sorry. For anybody that happened the shame.

The problem was the relationship of the vies. You have to make a relationship between the Location and your content field.

andrewsuth’s picture

For anyone else stuck on this, here is a more verbose description of how you access the fields inside the Location CCK. (ie. City, Country, Address, etc)

In this example, Venue is a Content type with a Location CCK field called Location

Now, within Views, do the following:

Relationships:
Content: Location

Fields:
Location: Country (which I set to have a relationship to "Location")

The relationship links your View to the CCK Location database table. Then when you add Location: Country it knows where to find it as it is linked to your View.

A brilliant videocast explaining Views2 relationships can be seen here: http://drewish.com/node/127
I recommend anyone struggling with Relationships to watch it a few times, until it sinks in.

Bartezz’s picture

Hi Andrew,

THANK YOU A BILLION! Have spent hours and hours figuring out why a view with type location did work with CCK location field but view with type node didn't.
Relationships did the job!

Cheers mate

andrewsuth’s picture

Hi Batrezz,

Glad it helped you out. I was also stuck on the same problem for several hours until I got a few hints from nahuelsgk's message above.

It appears undecipherable in the beginning but it really is worth spending the time learning the power of Relationships in the Views module. It adds a whole new level of flexability. I don't know how I developed sites without it before.

Bartezz’s picture