Answers.Body: <p>As usual with Craft you have several options. If you didn't need the index pages, I would suggest a <code>location</code> category, which you organized into 3 levels: states, regions, counties. Selecting a county location would also select its containing region and state. In your town entry you would do:</p>
  
  <pre><code>{% for l in entry.locations %}
    {{l.title}}
  {% endfor %}
  </code></pre>
  
  <p>You would go through the loop three times, and <code>{{l.title}}</code> would be the state, region, and then county.</p>
  
  <p>Disadvantages:</p>
  
  <ul>
  <li>nothing in Craft enforces that you properly organize your location categories</li>
  <li>nothing in Craft keeps you from choosing 3 states instead of one county for your town entry</li>
  <li>the location index pages will be hard to write</li>
  </ul>
  
  <p>Another option is to use a channel (or category) for states, a channel for regions, a channel for counties. The county entry would have a field for the containing region, the region entry would have a field for the containing state. And the town entry would have a field for the region. Then in the town template:</p>
  
  <pre><code>{{ entry.region.first.county.first.state.title }}
  </code></pre>
  
  <p>This will fail badly if any of the required relationships aren't there. You can test everything before you use it:</p>
  
  <pre><code>{% if entry.region.first %} ...
  </code></pre>
  
  <p>Or you can use the <code>??</code> (<a href="http://twig.sensiolabs.org/doc/templates.html#other-operators" rel="nofollow">null-coalescing</a>) operator:</p>
  
  <pre><code>{{ entry.region.first.county.first.state.title ?? 'no state' }}
  </code></pre>
  
  <p>Fetching the state title will be fairly expensive. You could use the <a href="https://github.com/aelvan/Preparse-Field-Craft" rel="nofollow">preparse</a> plugin to save the state name on the town entry.</p>
  
  <p>For the index pages, you will want the regions that are <a href="https://craftcms.com/docs/relations#the-relatedTo-param" rel="nofollow">related to</a> the state, etc.</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-09-02T19:28:09.513Z
Answers.Text: Amazing! Thank you so much for the detailed answer.
Answers.UserDisplayName: Steven Thate
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-09-02T19:29:14.687Z
Answers.Text: Glad to help!!!
Answers.UserDisplayName: Marion Newlevant
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-09-02T16:52:36.190Z
Answers.LastActivityDate: 2016-09-02T16:52:36.190Z
Answers.UserDisplayName: Marion Newlevant
Body: <p>I spent a fair amount of time yesterday searching for any other questions that may have been answered that are similar to this one, but haven't had much luck.</p>
  
  <p><strong>Essentially what I want to do</strong> is to daisy chain some Entry relationship fields. I'm not entirely sure if this is possible in Craft, as I haven't seen any documentation or commentary on it.</p>
  
  <p><strong>Here is how I would like to have my content organized.</strong> The site will have a few channels: States, Regions, Counties, Towns and Inductees. As you can tell, the relationships basically drill-down in an obvious way: States have Regions; Regions have Counties; while Counties have both Towns and Inductees. I like the idea of being able to add a new Town, select which County it belongs to, and automatically inherit the Region and State data. Ideally, I'd like to be able to do something in a Town template like <code>{{entry.state.title}}</code> which would pull the title of the state to which this town's county belongs.</p>
  
  <p>Now, the States and Regions basically are just lists... The States page will be an archive listing all the Regions in the State. The Regions page will be an archive listing all the Counties in the Region. Would these be better suited as Categories, than Channels? If so, would there still be a way to access the State from, say, a Town or Inductee entry? I'd rather not have to rely on the content editor to have to select states and regions for each new Town/Inductee entry. I'd rather they only have to select its County.</p>
  
  <p>I'm new to Craft, so I apologize if this question seems either absurd or incoherent :)</p>
  
  <p>Thanks!</p>
  
Tags: <entries><categories><relations>
Title: How/Can does Craft handle ancestor/grandparent relationships?
ThreadText: # How/Can does Craft handle ancestor/grandparent relationships?
  
  (Asked by: username_0 on 2016-09-02)
  
  I spent a fair amount of time yesterday searching for any other questions that may have been answered that are similar to this one, but haven't had much luck.
  
  **Essentially what I want to do** is to daisy chain some Entry relationship fields. I'm not entirely sure if this is possible in Craft, as I haven't seen any documentation or commentary on it.
  
  **Here is how I would like to have my content organized.** The site will have a few channels: States, Regions, Counties, Towns and Inductees. As you can tell, the relationships basically drill-down in an obvious way: States have Regions; Regions have Counties; while Counties have both Towns and Inductees. I like the idea of being able to add a new Town, select which County it belongs to, and automatically inherit the Region and State data. Ideally, I'd like to be able to do something in a Town template like `{{entry.state.title}}` which would pull the title of the state to which this town's county belongs.
  
  Now, the States and Regions basically are just lists... The States page will be an archive listing all the Regions in the State. The Regions page will be an archive listing all the Counties in the Region. Would these be better suited as Categories, than Channels? If so, would there still be a way to access the State from, say, a Town or Inductee entry? I'd rather not have to rely on the content editor to have to select states and regions for each new Town/Inductee entry. I'd rather they only have to select its County.
  
  I'm new to Craft, so I apologize if this question seems either absurd or incoherent :)
  
  Thanks!
  
  **Tags:** entries, categories, relations
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2016-09-02. Score: 4 | Accepted answer
  
  As usual with Craft you have several options. If you didn't need the index pages, I would suggest a `location` category, which you organized into 3 levels: states, regions, counties. Selecting a county location would also select its containing region and state. In your town entry you would do:
  
  ```
  {% for l in entry.locations %}
    {{l.title}}
  {% endfor %}
  
  ```
  
  You would go through the loop three times, and `{{l.title}}` would be the state, region, and then county.
  
  Disadvantages:
  
  * nothing in Craft enforces that you properly organize your location categories
  * nothing in Craft keeps you from choosing 3 states instead of one county for your town entry
  * the location index pages will be hard to write
  
  Another option is to use a channel (or category) for states, a channel for regions, a channel for counties. The county entry would have a field for the containing region, the region entry would have a field for the containing state. And the town entry would have a field for the region. Then in the town template:
  
  ```
  {{ entry.region.first.county.first.state.title }}
  
  ```
  
  This will fail badly if any of the required relationships aren't there. You can test everything before you use it:
  
  ```
  {% if entry.region.first %} ...
  
  ```
  
  Or you can use the `??` ([null-coalescing](http://twig.sensiolabs.org/doc/templates.html#other-operators)) operator:
  
  ```
  {{ entry.region.first.county.first.state.title ?? 'no state' }}
  
  ```
  
  Fetching the state title will be fairly expensive. You could use the [preparse](https://github.com/aelvan/Preparse-Field-Craft) plugin to save the state name on the town entry.
  
  For the index pages, you will want the regions that are [related to](https://craftcms.com/docs/relations#the-relatedTo-param) the state, etc.
  
  > **Comments:**
  > **username_0**: Amazing! Thank you so much for the detailed answer.  
  > **username_1**: Glad to help!!!  
  
  ---
  
  