Query Path instead of page-title

Hey,
I have a problem quite similar to here:

so I want to query the title of a different page like so:
`office:

            label: Office
            type: select
            options: query
            query: site.find('offices').children.listed
            multiple: false`

and then using this in the template:
<?php $office = $note->office()->title()?>

As a result I get the path: offices/kassel instead of the title: Kassel
Although I tried all the possibilities in the mentioned post, I still get either an query-error in the panel or php error in the template.
This was the alternative blueprint from the other post:
`office:

        label: Office
        type: select
        options: query
        query: 
          fetch: site.find("offices").children.listed
          text: "{{ arrayItem.title }}"
          value: "{{ arrayItem.title }}"
        multiple: false`

This was the alternative php code:
<?= page( $page->office() )->title() ?>

Both are not working…
Thank you ahead!

You have to convert into a page object before you can call the title:

<?php if ( $p = $page->office()->toPage() ) :  ?>
<?php echo $p->title() ?>
<?php endif ?>

But for this to work, you need to store the id of the page instead of title.

Ok thanks a lot, after lot of trying I finally understood :slight_smile:
for the future, here is the code:

` options: query
        query: 
          fetch: site.find("offices").children.listed
          text: "{{ page.title }}"
          value: "{{ page.id }}"`

template:
<?php if ( $office = $note->office()->toPage() ) : ?> <?php $officetitle = $office->title() ?> <?php endif ?>

The problem with the blueprint was: I first used type: pages but it has to be select
Dunno why

I thought you had a reason to use the select field. The pages field is usually the first thing to chose when dealing with pages as options. What did not work for you?

Then I get the error in the panel:

Error in “office” field
Invalid value for “query”

Its just possible if I query simple:
`office:

        label: Office
        type: pages
        options: query
        query: site.find("offices").children.listed`