Query number field of parent


is it possible to use a query to fill a page’s number field with the value of its parent’s number field?

thank you for any help!

Should be possible with

default: "{{page.parent.fieldname}}"

thanks for the answer!

just tried it with:

  type: number
  label: price.
  required: true
  default: "{{page.parent.price}}"

but that gives me a value of 0.

do you see any mistakes in the code?

the field in the parent blueprint:

  type: number
  label: price.
  required: true

Hm, that doesn’t seem to work as expected. @thguenther suggested it here, so I thought it should work: How to make dynamic placeholder for field in blueprint (from page title)?

Another option would be to use a page model and set the value in the writeContent() method.

Indeed. It seems like default queries do not work. They do work in placeholder.

It’s especially weird because it says “You can now use query templating in more blueprint options (help, default, label, empty and headline)” in the release notes. Placeholder is not mentioned.

okay, thank you very much for your answers, @texnixe and @thguenther!

i found a nice workaround now for me, so this problem is not an urgent problem anymore to me. should i mark the question as solved or should i leave it open?

Would you mind sharing your workaround? I think we can close this and will have to create an issue on GitHub

i changed the structure of the webpage a bit and grab the value of the parent’s field in the controller and template files.
probably is the better solution anyway since i don’t need another value for the children’s number fields anyway.

Do you want to add an issue on GitHub?
When testing I realized it works for textarea fields but not for text fields:

If it shouldn’t be changed in the children, then setting it once in the parent is definitely the better option, yes.

IMO, it should for all types of field, not only textarea fields.

Of course.