# \[Panel\] How to set Select-Fields Default by Query

**URL:** <https://forum.getkirby.com/t/panel-how-to-set-select-fields-default-by-query/23841>\
**Category:** Questions\
**Tags:** v3\
**Created:** [November 2, 2021, 1:51pm UTC](https://forum.getkirby.com/t/panel-how-to-set-select-fields-default-by-query/23841 "2021-11-02T13:51:29Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![dennisb](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/dennisb/32/11676_2.png) [@dennisb](https://forum.getkirby.com/u/dennisb)\
**Post date:** [November 2, 2021, 1:51pm UTC](https://forum.getkirby.com/t/panel-how-to-set-select-fields-default-by-query/23841/1 "2021-11-02T13:51:29Z")

</div>

Hi all,

in a K3.5 i would like to query the data for a select-field from a global structure-field and set the default by the first element of that structure. Unfortenetly that doesn’t work like i want. I would be really happy, if someone can help me here :\*

### i have a global teaser structure in site.yml

```auto
teasers:
  label: Global Teasers
  type: structure
  fields:
    id:
      label: ID
      type: text
      required: true
    teaserh2:
      label: Headline
      type: text
      required: true
    ...

```

and a selectfield in page-xy.yml, fetching the structure

```auto
teaser:
  label: Select from global Teasers
  type: select
  options: query
  query:
    fetch: site.teasers.toStructure
    text: "{{ structureItem.id }}"
    value: "{{ structureItem.id }}"
  default: About
  # default: site.teasers.toStructure.first.id

```

Unfortenetly i am not able to set the default-value by the id of the first element in the structure.  
I have tried several formats. If i hardcode the id, it works - but i need always the first item to be the default.

### A second question:

I would like to set text and value of the selectfield-data to lowercase.  
Unfortenetly that won’t work also.

```auto
teaser:
  label: Select from global Teasers
  type: select
  options: query
  query:
    fetch: site.teasers.toStructure
    text: "{{ structureItem.id.lower }}"
    value: "{{ structureItem.id.lower }}"

```

All i get then is that:

 ![grafik](https://europe1.discourse-cdn.com/flex017/uploads/getkirby/original/2X/9/9abdd9b7198c0470ff4a002fb2c6e1cf1c65d8ad.png)

What am i doing wrong here?

Thx!

---

<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:** [November 2, 2021, 4:25pm UTC](https://forum.getkirby.com/t/panel-how-to-set-select-fields-default-by-query/23841/2 "2021-11-02T16:25:41Z")

</div>

Query syntax is not supported for the default property, I think.

`id` is a member method of the structureObject, which returns a string.

Try `structureItem.content.get('id').lower` instead.

I wouldn’t convert the value though (or you have to make sure you find the element by lowercase again).

---

<div class="post-metadata">

**Author:** ![dennisb](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/dennisb/32/11676_2.png) [@dennisb](https://forum.getkirby.com/u/dennisb)\
**Post date:** [November 2, 2021, 7:01pm UTC](https://forum.getkirby.com/t/panel-how-to-set-select-fields-default-by-query/23841/3 "2021-11-02T19:01:54Z")

</div>

> [@texnixe](#):
>
> Query syntax is not supported for the default property, I think.

i think now also 😪 tried some other things, but was not successful.

> [@texnixe](#):
>
> Try `structureItem.content.get('id').lower` instead.

works 👍

> [@texnixe](#):
>
> I wouldn’t convert the value though (or you have to make sure you find the element by lowercase again).

i am going to use autoid - think that is much cleaner than names anyway, but however it is good to know the solution above

thx @texnixe
