I want to carry over a previous balance and calculate a new total

Article Number:040738

By using the Actions feature, you can retrieve a previous balance and use it when calculating a new balance.
Actions setting

This article explains how to calculate a new balance by applying deposits and withdrawals to the cumulative balance from the previous day.

Configuring fields

Place the following fields on your app form. We'll call this app the "Cash Deposits and Withdrawals App".

Example of field settings
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 app form.

Configuring actions

Next, we'll configure an action to use.

  1. On the App settings screen, select the App settings tab, and then click Actions under Advanced settings.

  2. Click Create action on the upper left of the screen.

  3. Configure the settings for the action and click Save.
    See below for an example of how the settings should look.

    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

    Screenshot of example action settings

  4. Go back to App settings and click Update app.

  5. On the confirmation dialog, click Update app.

Adding a record and retrieving the previous balance to calculate the total balance

  1. Open the "Cash Deposits and Withdrawals" app, then click the New record icon at the upper right of the screen.
  2. Enter a number into each field and save the record.
    The value of the "Total Balance" field will be calculated automatically according to the specified formula. Screen showing the "Total Balance" field calculated automatically
  3. On the Record details screen of the record added in Step 2, click Add record and get the balance.
    The New record screen will open with the value for the "Balance as of Yesterday" field populated. The location of the "Add record and get the balance" button
  4. Change the date, enter the deposit and withdrawal amounts, and then save the record. Screen showing the "Balance as of Yesterday" carried over

If you add a new record the next day, the updated balance will be retrieved into the "Balance as of Yesterday" field.