# Get data from structure to populate info field for pages list

**URL:** <https://forum.getkirby.com/t/get-data-from-structure-to-populate-info-field-for-pages-list/25514>\
**Category:** Questions\
**Tags:** v3\
**Created:** [May 16, 2022, 9:38pm UTC](https://forum.getkirby.com/t/get-data-from-structure-to-populate-info-field-for-pages-list/25514 "2022-05-16T21:38:00Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Dominique](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/dominique/32/6631_2.png) [@Dominique](https://forum.getkirby.com/u/Dominique)\
**Post date:** [May 16, 2022, 9:38pm UTC](https://forum.getkirby.com/t/get-data-from-structure-to-populate-info-field-for-pages-list/25514/1 "2022-05-16T21:38:00Z")

</div>

For page\_A, I have a blueprint with some data on structure, let’s name them links:

```auto
my_list_of_URLs:
            label: Here are my URLS
            type: structure
            fields:
              myUrl:
                label: URL
                type: text
                required: true
              myTitle:
                label: Title
                type: text
              myCollection:
                label: Collection
                type: select
                required: true
                options:
                  square: SQUARE
                  fineArt: FINE ART

```

I then have another page, let’s call it `page_B`, which blueprint display a list of `page A` (thanks to [PagesDisplay Section](https://getkirby.com/plugins/rasteiner/pagesdisplay) plugin).  
So this list contains element of type `page A`.  
I then want to display additional data for each item extracted from the previous `my_list_of_URLs` structure.

```auto
my_list_strange_stuff:
            headline: some Page_A stuff
            type: pagesdisplay
            query: site.find("page_A").children.children.filterBy("okHouston",true)
            controls: false
          
            info: " {{ page.my_list_of_URLs.toStructure... }}"
            limit: 10

```

And I don’t know what to to next. The exact need is to display as info all `myCollection` defines for `page_A`.  
In other words, how can I retrieve the list of `myCollection` data contained in all elements from the structure?

So what is missing is this portion of code:  
`info: " {{ page.my_list_of_URLs.toStructure ***THE MISSING PART*** }}"`

A picture is better than thousand words so here is one:

 ![Capture d’écran 2022-05-16 à 23.30.18](https://europe1.discourse-cdn.com/flex017/uploads/getkirby/original/2X/a/a5d97c3b4e8b006b4ca22b06b9c03586d411d62b.jpeg)

So for the first line, painting 2018-005, structure looks like:

| myUrl | myTitle | myCollection |
| --- | --- | --- |
| 11111111 | square poster on black | square |
| 222222 | high quality print | fineArt |

---

<div class="post-metadata">

**Author:** ![texnixe](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/texnixe/32/5754_2.png) [@texnixe](https://forum.getkirby.com/u/texnixe)\
**Post date:** [May 16, 2022, 10:16pm UTC](https://forum.getkirby.com/t/get-data-from-structure-to-populate-info-field-for-pages-list/25514/2 "2022-05-16T22:16:42Z")

</div>

For that you need a custom page method/model method that returns the values you need as comma separated list.

e.g. method getMyCollectionList() would return

```auto
implode(', ', $page->my_list_ofURLs()->toStructure()->pluck('myCollection', ',', true))

```

---

<div class="post-metadata">

**Author:** ![Dominique](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/dominique/32/6631_2.png) [@Dominique](https://forum.getkirby.com/u/Dominique)\
**Post date:** [May 17, 2022, 6:08am UTC](https://forum.getkirby.com/t/get-data-from-structure-to-populate-info-field-for-pages-list/25514/3 "2022-05-17T06:08:12Z")

</div>

> [@texnixe](#):
>
> custom page method

Hi,

Thank you ! I created a model in this case. It works fine!  
Again: a great than you!

I wish you a beautiful and lightfull day!  
😀 🌞
