Getting Structured Data inside YML and Displaying in Panel

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

My txt file

----

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

  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?!

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).

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?

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

 Product: {{ page.items.toStructure.first.name }}<br> 
1 Like

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.