Retrieving the Previous Balance and Calculating the Current Balance
By using the Actions feature, you can retrieve the previous balance and then calculate the current total balance in an app.
Actions setting
This topic explains how to calculate the current total balance by adding deposits and subtracting withdrawals based on the balance as of yesterday.
Configuring Fields
Add the following fields to the Form in the app you are creating. Then, set the app name to "Cash Deposits and Withdrawals app".
Field Name | Field code | Field Type |
---|---|---|
Date | Date | Date |
Balance as of Yesterday | Balance_as_of_Yesterday | Number |
Deposit | Deposit | Number |
Withdrawal | Withdrawal | Number | Total Balance | Total_Balance | Calculated - Formula: Balance_as_of_Yesterday + Deposit - Withdrawal |
After placing the above fields, save the Form.
Configuring the Actions
Next step is to configure the Actions feature.
-
On the "App Settings" screen, select the App Settings tab, and then click Actions under Advanced Settings.
-
Click Add on the upper right of the screen.
-
Configure the settings for the action and click Save.
The following shows an example of the settings.Example of Action Settings Action Name Add record and get the balance Target Cash Deposits and Withdrawals app (This app) Field Mappings Total Balance > Balance as of Yesterday Available To: Everyone -
Go back to App Settings and click Update App.
-
On the confirmation dialog, click Update App.
Adding a Record and Retrieving the Previous Balance to Calculate the Total Balance
- Open the "Cash Deposits and Withdrawals" app, then click the Add Record icon at the upper right of the screen.
- Enter a number into each field and save the record.
"Total Balance" will be calculated automatically according to the specified formula. - On the Record Details screen showing the record added in step 2, click the Add record and get the balance.
A new screen to add a new record opens with the value for Balance as of Yesterday populated. - Change the date, enter the deposit and withdrawal amounts, and then save the record.
When you add a new record the next day, today’s total balance will be retrieved into the Balance as of Yesterday field.