Hey everyone,
My application tracks customer balances against payments that come in via both cash/check and Creator's PayPal API in this view:
It updates automatically from "submit/success" actions in the payment forms, but occasionally payments are misapplied, thus requiring edits that do not automatically tally (along with other small miscellaneous issues)
This issue is currently is solved by simply clicking "edit" on each record, because the following "on edit - on load" script executes each time
- balupdate2 = MHL_Manual_Payment_Entry[((Season1 == input.Current_Last_Season_New && Team_Name2 == input.Team_Name) && Method == "Opening Balance (Negative Value Only)")].sum(Amount);
- Opening_Balance_Bal_Fwd=(balupdate2 * -2 / 2);
- balupdate1 = MHL_Manual_Payment_Entry[(((Season1 == input.Current_Last_Season_New && Team_Name2 == input.Team_Name) && Method != "Opening Balance (Negative Value Only)") && PayPal_Status != "Pending")].sum(Amount);
- Payment_To_Date=balupdate1;
- Bal_Remain=(input.Opening_Balance_Bal_Fwd - input.Payment_To_Date);
- Pct_Paid=(input.Payment_To_Date / input.Opening_Balance_Bal_Fwd * 100);
Problem is that it's kind of a pain to have to click edit and save on every single record (85+ of them) every single day, especially when they're not always incorrect.
I could probably tighten up the code for the pertinent payment records tabulated here, but I'm more interested in learning how functions work and how to create them.
Does anyone have an example code for a function that performs a similar calculation, with a button on top of the form that would update all record atop the view?
Thanks,
Dan