[SOLVED] Get total from detail form (editable grid) in a field on the master form

I have a master form with a detail editable grid on it. It has a column which contains numeric values. I would like to total these values in a field on the master form below it.

A way to update in real time is needed so the user can see a sort of running total.

Any help would be greatly appreciated. I’ve already added a custom field on the master form.

Thanks in advance.

Look at documentation on macro sc_master_value().

Thank you for the reply. Im just starting out with SC.
Can you please confirm if this code should go on the master form? So far its not working. Upon run-time Im asked to enter the global variable.
Loads with a local variable but doesn’t calculate anything.

A little more detail of my particular case.
The detail form has a field called debit which has to be totaled and I want to show it on the master form in a field called Total.

Once again thank you for the reply.

Hmm, wasn’t able to get that to work, however this worked fine: http://www.scriptcase.net/forum/showthread.php?2882-SOLVED-Master-Detail-(Master-Total)

Anyways thanks for the guidance.

No, use sc_master_value() in detail form, but the other solution is also ok.

Ok I’ll give that a try. Because now I have the problem of the Total field on the master form not updating in real time when a new entry is made on the detail form.

Thanks for replying.

Use sc_master_value() in the events onAfterInsert, onAfterUpdate and onAfterDelete of your detail forum if you want to refresh the master form in real time.

Once again thanks for taking the time to reply. Can you please tell me how to pass the value from the master form to the detail form? What should I enter on the master form and where?

Thanks

Got it working. Thank you so much.