Blueprint select option: query more values

Hello,

how to fetch more values ?

  autor:
    label: Autor
    type: select 
    options: query
    query:
      page: /autoren-und-veranstaltungen/autoren
      fetch: children
      value: '{{title,firstname}}'
      text: '{{title}}'

greeting perry

Could you be more precise, please? What sort of values? Do you want to fetch children of other pages as well? Or do you mean store more than just the title? I’d store the URI, though, not a mixture of title and name.

I want fetch the values fron this fields:

  title:
    label: Name
    type: title

  firstname:
    label: Vorname
    type: title

Where is the point of doing that? You probably want to display these values in the text key, not the value key, right? Or at least that is what I would recommend. The URI is unique, so it makes sense to store it in the file.

autor:
    label: Autor
    type: select 
    options: query
    query:
      page: /autoren-und-veranstaltungen/autoren
      fetch: children
      value: '{{uri}}' #this gets saved to file
      text:  '{{title}}, {{firstname}}' #this is shown to user

Thanky you @texnixe that’s how it worked for me
(I hope I do not need functionality of the uri :wink: )

  autor:
    label: Autor
    type: select 
    options: query
    query:
      page: /autoren-und-veranstaltungen/autoren
      fetch: children
      value: '{{title}} {{firstname}}'
      text: '{{title}} {{firstname}}'

It would be easier to later fetch the page in your templates/controllers, if you use the URI, but it is of course up to you.

yes i know,
but the client would sort the autor pages by the lastname (into the panel),
that’s why I separated the title field in a Name-Field and a Firstname-Field…
hmh maybe I must explain the clinet the title field is only for sorting

I don’t see how what is stored in the content file has anything to do with the sorting.

If you store the author URI, you can later get the page like this:

$author = page($page->autor());
if($author) {
  echo $author->title().', '.$author->first name();
}

Otherwise, you will first have to split the field value to extract the title and then search by title. But if you like it complicated, then well … The client doesn’t even see in the Panel what gets stored in the file, unless he inspects the content files in the filesystem.