top of page

Moji5 Knowledgebase

Summing up the total value in a table column

Problem

You need to sum up the values in a table column for all rows and display its total in another field on the form.


Solution

Setting up the sample:

1. Create a new form called "Sample Amount"

2. Create two fields:

  • Total amount (money field)

  • Items (table)


3. In the "Items" table, create the following 2 fields:

  • Item name (single line)

  • Amount (money field)


Solution:

1. Click the "Edit form behavior" button

2. Create a new form behavior

3. Click the "Action wizard" link

4. Click the "Create an action" button

5. Click on the "Table Column Summation" action


6. In the next page, select the "Items" table, and select the "Amount" table column. Select the "Total amount" form field as the target to display the summed up value. Click OK.


7. Save your changes and click the Create now button to create the behavior.


8. Publish your form.


Testing your solution:

1. Run the application & launch the form.

2. Click on the "Add record" button in the "Items" table. Type in a value for the item name and a value for the amount field.

3. Repeat to create about 2-3 rows. As soon as you add each row, you should see the amount auto-computed automatically (as shown below).


An additional note is that you might also want to set the "Total amount" field to disabled, so that it will appear as read-only to the user.

Comments


bottom of page