I have a resource node type that references the author(s) of the post via a node reference CCK field. The authors are not necessarily still living or using the site so they are just an author node type that has nothing to do with Drupal users. We want to be able to sort the resources by authors last name that is stored in the node for the author.
Right now the node reference is based on title which is a concatenation of the title, first name, last name and suffix fields so it would be hard to write a regular expression to do this off of the title. We have examples of authors with and without middle names for example.
I was thinking I could just create a relationship and then sort on the relationship but I don't see this as an option in views.
Thanks,
Steve
Steve Kessler
Denver DataMan
303-587-4428
http://www.denverdataman.com/denver-dataman-e-newsletter-signup Sign up for the Denver DataMan Free eNewslettter
"Getting the right information, to the right people, at the right time"
I struggle with relationships a little bit, but basically creating the relationship just links the two nodes via the node id used in the node reference field. Once that relationship is in place though you should be able to pull fields from the related node (such as the surname you mention) and then you can sort on it. When you add the surname it will ask you if you want to use a relationship with it.
The video in the first link below is a great primer and the second one goes into a bit more detail.
http://gotdrupal.com/videos/drupal-views-relationships http://drewish.com/node/127
Anthony.
On 6:59 AM, Steve Kessler wrote:
I have a resource node type that references the author(s) of the post via a node reference CCK field. The authors are not necessarily still living or using the site so they are just an author node type that has nothing to do with Drupal users. We want to be able to sort the resources by authors last name that is stored in the node for the author.
Right now the node reference is based on title which is a concatenation of the title, first name, last name and suffix fields so it would be hard to write a regular expression to do this off of the title. We have examples of authors with and without middle names for example.
I was thinking I could just create a relationship and then sort on the relationship but I don’t see this as an option in views.
Thanks,
Steve
Steve Kessler
*Denver DataMan *
303-587-4428
Sign up for the Denver DataMan Free eNewslettter http://www.denverdataman.com/denver-dataman-e-newsletter-signup
"Getting the */right information/*, to the */right people/*, at the */right time/*"
The problem is that when I go to the relationships in views I dont have those relevant fields available to me.
How does views decide what you can reference? Can I force views to let me reference more?
Thanks, Steve
I struggle with relationships a little bit, but basically creating the relationship just links the two nodes via the node id used in the node reference field. Once that relationship is in place though you should be able to pull fields from the related node (such as the surname you mention) and then you can sort on it. When you add the surname it will ask you if you want to use a relationship with it.
The video in the first link below is a great primer and the second one goes into a bit more detail.
http://gotdrupal.com/videos/drupal-views-relationships http://drewish.com/node/127
Anthony.
On 6:59 AM, Steve Kessler wrote:
I have a resource node type that references the author(s) of the post via a node reference CCK field. The authors are not necessarily still living or using the site so they are just an author node type that has nothing to do with Drupal users. We want to be able to sort the resources by authors last name that is stored in the node for the author.
Right now the node reference is based on title which is a concatenation of the title, first name, last name and suffix fields so it would be hard to write a regular expression to do this off of the title. We have examples of authors with and without middle names for example.
I was thinking I could just create a relationship and then sort on the relationship but I dont see this as an option in views.
Thanks,
Steve
Steve Kessler
*Denver DataMan *
303-587-4428
Sign up for the Denver DataMan Free eNewslettter http://www.denverdataman.com/denver-dataman-e-newsletter-signup
"Getting the */right information/*, to the */right people/*, at the */right time/*"
-- [ Drupal support list | http://lists.drupal.org/ ]
Steve,
Under Relationships, you should see all CCK nodereference fields as options to select. So if in your post, the field you use to reference the author node is field_page_author, then that field should appear as a Relationship to be added. Choose that field, and then the relationship will be available to use in your sort criteria.
To apply the sorting (after establishing the relationship), add a new sort criteria, choose the field you use for the last name of the author (e.g. field_author_lastname), and on the next screen, choose the relationship you created.
Hope that helps! Michelle
On 6/14/2010 6:19 AM, skessler@denverdataman.com wrote:
The problem is that when I go to the relationships in views I dont have those relevant fields available to me.
How does views decide what you can reference? Can I force views to let me reference more?
Thanks, Steve
I struggle with relationships a little bit, but basically creating the relationship just links the two nodes via the node id used in the node reference field. Once that relationship is in place though you should be able to pull fields from the related node (such as the surname you mention) and then you can sort on it. When you add the surname it will ask you if you want to use a relationship with it.
The video in the first link below is a great primer and the second one goes into a bit more detail.
http://gotdrupal.com/videos/drupal-views-relationships http://drewish.com/node/127
Anthony.
On 6:59 AM, Steve Kessler wrote:
I have a resource node type that references the author(s) of the post via a node reference CCK field. The authors are not necessarily still living or using the site so they are just an author node type that has nothing to do with Drupal users. We want to be able to sort the resources by authors last name that is stored in the node for the author.
Right now the node reference is based on title which is a concatenation of the title, first name, last name and suffix fields so it would be hard to write a regular expression to do this off of the title. We have examples of authors with and without middle names for example.
I was thinking I could just create a relationship and then sort on the relationship but I don’t see this as an option in views.
Thanks,
Steve
Steve Kessler
*Denver DataMan *
303-587-4428
Sign up for the Denver DataMan Free eNewslettter http://www.denverdataman.com/denver-dataman-e-newsletter-signup
"Getting the */right information/*, to the */right people/*, at the */right time/*"
-- [ Drupal support list | http://lists.drupal.org/ ]
I was just about to write to the group and say I figured this out. I was stuck on the concept of relating to the last name field.
Thanks to everyone for your help.
Thanks, Steve
Steve Kessler Denver DataMan 303-587-4428 Sign up for the Denver DataMan Free eNewslettter
"Getting the right information, to the right people, at the right time"
-----Original Message----- From: Michelle Ziegmann [mailto:michelle@media.berkeley.edu] Sent: Monday, June 14, 2010 11:23 AM To: support@drupal.org Subject: Re: [support] View Relationships Question
Steve,
Under Relationships, you should see all CCK nodereference fields as options to select. So if in your post, the field you use to reference the author node is field_page_author, then that field should appear as a Relationship to be added. Choose that field, and then the relationship will be available to use in your sort criteria.
To apply the sorting (after establishing the relationship), add a new sort criteria, choose the field you use for the last name of the author (e.g. field_author_lastname), and on the next screen, choose the relationship you created.
Hope that helps! Michelle
On 6/14/2010 6:19 AM, skessler@denverdataman.com wrote:
The problem is that when I go to the relationships in views I dont have those relevant fields available to me.
How does views decide what you can reference? Can I force views to let me reference more?
Thanks, Steve
I struggle with relationships a little bit, but basically creating the relationship just links the two nodes via the node id used in the node reference field. Once that relationship is in place though you should be able to pull fields from the related node (such as the surname you mention) and then you can sort on it. When you add the surname it will ask you if you want to use a relationship with it.
The video in the first link below is a great primer and the second one goes into a bit more detail.
http://gotdrupal.com/videos/drupal-views-relationships http://drewish.com/node/127
Anthony.
On 6:59 AM, Steve Kessler wrote:
I have a resource node type that references the author(s) of the post via a node reference CCK field. The authors are not necessarily still living or using the site so they are just an author node type that has nothing to do with Drupal users. We want to be able to sort the resources by authors last name that is stored in the node for the author.
Right now the node reference is based on title which is a concatenation of the title, first name, last name and suffix fields so it would be hard to write a regular expression to do this off of the title. We have examples of authors with and without middle names for example.
I was thinking I could just create a relationship and then sort on the relationship but I don't see this as an option in views.
Thanks,
Steve
Steve Kessler
*Denver DataMan *
303-587-4428
Sign up for the Denver DataMan Free eNewslettter http://www.denverdataman.com/denver-dataman-e-newsletter-signup
"Getting the */right information/*, to the */right people/*, at the */right time/*"
-- [ Drupal support list | http://lists.drupal.org/ ]