Get parent element on select field query

I have three nested categories that brands, brand and model. I want to list models with brand name to preventing confusions.

How can i get parent title on select field with query?

Blueprint

vehicle:
	label: Vehicle
	type: select
	options: query
	query: 
		page: brands
		fetch: pages
		value: '{{uid}}'
		text: '{{ {{parent}}.title }} {{title}}'
		template: model
		flip: true
	required: true

But didnt work.

Expected Output

Audi A6

Audi is brand
A6 is model that under the Audi category.

{{parent}}.title is not valid and you would want to fetch children if you want to query subpages of “brands”.

How does your exact page hierarchy look like?
If your page structure looks like this:

  • brands
    • Audi
      • A3
      • A4
      • A6
    • Mercedes

You should be able to use:

query: 
    page: brands
    fetch: children
    value: '{{uid}}'
    text: '{{parent}} {{title}}'
    template: model
    flip: true

Which would result in "audi A6"
The only caveat with this is that the brand would be in lowercase.

Let me know if this helps!

Thanks @Targoran. I tried before {{parent}} {{title}} but appeared only page uri like that:

brands/audi A6

I just want to show title of parent: Audi A6.

I searched code details and there is only page item as $item. No access $parent object.

That’s confusing. How does your page structure look like then?
In my testing {{parent}} worked and showed me the name of the page of which I’m getting the children from. But now that I say it for your case it would be “brands” which isn’t what you wanted.

But as I said, would be easier to find a solution if we knew your page/subpage structure.
Oh and how do you reference the brand to each model? If you have a custom field for the “brand” you would easily be able to reference that!

For example: The model “A6” has a custom field called “brand” which has the value of “Audi”. (This field could be populated with a query for all brands to choose from)
This would allow you to set the query for your vehicle field to: text: '{{brand}} {{title}}'

  • brands
  • Audi
    • A3
    • A4
    • A6
  • Mercedes

Your structure is right! And ``{{parent}}` tag return parent uri instead of title or another field.