Calculate Field Values in Panel

Hello.

Can you please tell me if it is possible to have following scenario:

There are 4 fields in the blueprint, A, B, C and D, each populated with the number.

The fifth field Sum should take the values from above fields and do some calculations with it, for example: A + B + C / D and of course show the result in the same blueprint.

Thank you very much.

On the fly this won’t be possible out of the box, because the fields don’t know anything of each other. You could populate such a sum field on save.

Yeah, that is the idea.
Any pointers?

a page model and an info field or section?

/site/models/alphabet.php

AlphabetPage extends Kirby\Cms\Page {
  public function sum() {
    $a = $this->a()->toFloat();
    $b = $this->b()->toFloat();
    $c = $this->c()->toFloat();
    $d = $this->d()->toFloat();

    return $a + $b + $c / $d;
  }
}

/site/blueprints/pages/alphabet.yml

title: Alphabet page
fields:
  a: 
    type: number
  b: 
    type: number
  c: 
    type: number
  d: 
    type: number
    validate:
      different: 0
  infofield:
    type: info
    text: "The result is: {{ page.sum }}"
  

@rasteiner Thank you. This works like a charm.