Вопрос

I have a DataObject with multiple entries. Each entry has a variable named Sum.

I would like to add all the Sum variables together with a function on the related page.

How do I do this?

Это было полезно?

Решение

You can use something like:

public function getTotalSum() {
    return MyDataObject::get()->sum('Sum');
}
Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top