# Getting Structured Data inside YML and Displaying in Panel

**URL:** <https://forum.getkirby.com/t/getting-structured-data-inside-yml-and-displaying-in-panel/22945>\
**Category:** Questions\
**Tags:** v3\
**Created:** [July 20, 2021, 3:52pm UTC](https://forum.getkirby.com/t/getting-structured-data-inside-yml-and-displaying-in-panel/22945 "2021-07-20T15:52:12Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![randomobject](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/randomobject/32/4894_2.png) [@randomobject](https://forum.getkirby.com/u/randomobject)\
**Post date:** [July 20, 2021, 3:52pm UTC](https://forum.getkirby.com/t/getting-structured-data-inside-yml-and-displaying-in-panel/22945/1 "2021-07-20T15:52:12Z")

</div>

This might be very simplistic but how do I display data from a structure field in the panel. Examples:

My txt file

```auto
----

Items:

- 
  id: >
    URL
  quantity: 1
  price: 645
  stock: "0"
  name: Oslo <--- This Line
  details: Sink Only
  dimensions: 650 x 420 x 120
  colour: Natural
  title: Natural
  taxrate: 0
  tax: 0
  sum: 645
  sumtax: 0

----

```

and my yml file is

```auto
  infoOrder:
    label: Details
    type: info
    width: 1/2
    options: query
    query: page.items.toStructure
    text: >
      Invoice Number: {{ page.invoiceNumber }}<br>
      Product: {{ structureItem.name }}<br> <--- To this Line
      Sum: {{ page.formattedSum }}<br>
      Invoice Date: {{ page.invoiceDate }}<br>
      Payed Date: {{ page.payedDate }}<br>
      Address: {{ page.address }}<br>
      City: {{ page.city }}<br>
      Postcode: {{ page.postcode }}<br>
      Email: {{ page.email }}<br>

```

Under Product: I am trying to display the ‘name’ from ‘Items’. Hope that’s clear?!

---

<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:** [July 20, 2021, 4:36pm UTC](https://forum.getkirby.com/t/getting-structured-data-inside-yml-and-displaying-in-panel/22945/2 "2021-07-20T16:36:13Z")

</div>

First, an info field doesn’t have a query property, so `page.items.toStructure` has no effect. Secondly, `page.items.toStructure` would be a collection, not a single item. So from which item would you want to get the information? The only way to get the info from the structure field into your info field, would be through a page model (or a custom page method).

---

<div class="post-metadata">

**Author:** ![randomobject](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/randomobject/32/4894_2.png) [@randomobject](https://forum.getkirby.com/u/randomobject)\
**Post date:** [July 20, 2021, 4:44pm UTC](https://forum.getkirby.com/t/getting-structured-data-inside-yml-and-displaying-in-panel/22945/3 "2021-07-20T16:44:54Z")

</div>

Ah, ok. Thanks for the info. The info I am trying to display is:

`name: Oslo`

into

`Product:`

I’ve commented in the origional post. Hope I am clear enough? Is it poss?

---

<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:** [July 20, 2021, 4:52pm UTC](https://forum.getkirby.com/t/getting-structured-data-inside-yml-and-displaying-in-panel/22945/4 "2021-07-20T16:52:52Z")

</div>

> [@randomobject](#):
>
> ` Product: {{ structureItem.name }}<br> <--- To this Line`

Assuming you had only this one entry in your structure field or you want to get the information from the first entry, you could use

```auto
 Product: {{ page.items.toStructure.first.name }}<br> 

```

---

<div class="post-metadata">

**Author:** ![randomobject](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/randomobject/32/4894_2.png) [@randomobject](https://forum.getkirby.com/u/randomobject)\
**Post date:** [July 20, 2021, 5:40pm UTC](https://forum.getkirby.com/t/getting-structured-data-inside-yml-and-displaying-in-panel/22945/5 "2021-07-20T17:40:55Z")

</div>

> [@texnixe](#):
>
> `page.items.toStructure.first.name`

Bingo. That worked. I did have `page.items.toStructure.name` at some point but without `first` which was obviously what I was missing.

Thank you.
