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

記事番号: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 nameField codeField type
DateDateDate
Balance as of YesterdayBalance as of YesterdayNumber
DepositDepositNumber
WithdrawalWithdrawalNumber
Total BalanceTotal 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 nameAdd record and get the balance
    TargetCash Deposits and Withdrawals App (This app)
    Field mappingsTotal Balance > Balance as of Yesterday

    Screenshot: The "Create action" screen configured with the settings from the "Example of action settings" table

  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.
    Screenshot: The screen where "Total Balance" is automatically displayed

  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.
    Screenshot: The screen where the "Add record and get the balance" button is highlighted

  4. Change the date, enter the deposit and withdrawal amounts, and then save the record.
    Screenshot: The screen where the total balance is carried over

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