# toStructure getting only one object (without foreach)

**URL:** <https://forum.getkirby.com/t/tostructure-getting-only-one-object-without-foreach/5247>\
**Category:** Questions\
**Tags:** v2\
**Created:** [September 13, 2016, 3:22pm UTC](https://forum.getkirby.com/t/tostructure-getting-only-one-object-without-foreach/5247 "2016-09-13T15:22:14Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![carstengrimm](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/carstengrimm/32/188_2.png) [@carstengrimm](https://forum.getkirby.com/u/carstengrimm)\
**Post date:** [September 13, 2016, 3:22pm UTC](https://forum.getkirby.com/t/tostructure-getting-only-one-object-without-foreach/5247/1 "2016-09-13T15:22:14Z")

</div>

Is there a way to get one entry from a structured content without running though all entries?

e.g. i have 7 entries in my structure and i just want to echo the 6th entry’s content.

---

<div class="post-metadata">

**Author:** ![thguenther](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/thguenther/32/16708_2.png) [@thguenther](https://forum.getkirby.com/u/thguenther)\
**Post date:** [September 13, 2016, 3:37pm UTC](https://forum.getkirby.com/t/tostructure-getting-only-one-object-without-foreach/5247/2 "2016-09-13T15:37:44Z")

</div>

There’s the `nth()` function: [https://getkirby.com/docs/toolkit/api/collection/nth](https://getkirby.com/docs/toolkit/api/collection/nth)

So you can simply do something like that:

```
<?= $page->structurefield()->toStructure()->nth(6)->name() ?>
```

---

<div class="post-metadata">

**Author:** ![carstengrimm](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/carstengrimm/32/188_2.png) [@carstengrimm](https://forum.getkirby.com/u/carstengrimm)\
**Post date:** [September 13, 2016, 3:43pm UTC](https://forum.getkirby.com/t/tostructure-getting-only-one-object-without-foreach/5247/3 "2016-09-13T15:43:31Z")

</div>

great,i have known about the nth() function, but i didn’t think it’ll work with toStructure as well, fantastic, works like a charm 🙂

---

<div class="post-metadata">

**Author:** ![distantnative](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/distantnative/32/11319_2.png) [@distantnative](https://forum.getkirby.com/u/distantnative)\
**Post date:** [February 6, 2025, 4:55pm UTC](https://forum.getkirby.com/t/tostructure-getting-only-one-object-without-foreach/5247/4 "2025-02-06T16:55:14Z")

</div>


