You can use something like:
public function getTotalSum() {
return MyDataObject::get()->sum('Sum');
}
Вопрос
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');
}