I have a big problem with taking a simple Total Cost from an array!
I have an entity called currentCost, it contains two attributes: costAmount and costDesc. I bind it to an array controller and I have no problem when I add and remove items to and from this entity. The problem is to get the Total Cost from the costAmount attributes and show it in a text field.
I think I have to fetch all costAmounts to another array and take the total of them, but it seems I don’t know how to do this! What is the best approach ?
Thank you in advance.
Bind the text field to the array controller and specify
@sum.costAmountas the key path.