I've understand that you would like to "Get a Grand total" of the "Cost" field where the Cost field is part of a Data page. I've tried to do the same and able to achieve what you are looking for. Please look at the same below.
Please follow the below steps to achieve the same. I used basic presentation (where and how to show the field), you can play around presentation based on application requirement.
1) Configure table (Repeat grid) as shown below.
2) Goto grid properties > Operations > Advanced
2) The activity configuration looks like below (I'm just adding tabs which I touched for the configuration)
3) The second step contains Data Transform, configuration of data transform looks like,
4) Now, everytime adding row or deleting a row updates the "GrandToal" property in "GrandTotalPage" in the clipboard. Use the same to display in the UI,
Now, what if user edited the "Cost" field at runtime, this needs dynamic update of grand total, Right, Call the same activity on change of the "Cost" field, as shown below.
If the grid has a preexisting records, and if we would like to show the grid onload of the grid, call the activity as shown below.
Put your grid inside a dynamic layout.
And configure a deferload on the dynamic layout properties panel and specify the pre load activity as shown below.
That it !!, Its working as expected for me. It should work for you too. If you have a different scenario to update the grand total, Please find a place to call the activity, that would update the grand total.