Expand my Community achievements bar.

Dive into Adobe Summit 2024! Explore curated list of AEM sessions & labs, register, connect with experts, ask questions, engage, and share insights. Don't miss the excitement.

Subform calculations

Avatar

Level 2

I am a group of fields that need to add together.

Period    Payment     Cumulative Payment

     1.          500               500

     2.          500               1,000

     3.          500               1,500

Ex. Person would enter payment amount and the cumulative payment would add last cumulative pymt to #2 payment.

I have set up a subform to add more lines.  I can't figure out how to get the new lines to add correctly. 

Also is is possible to get the Period numbers to go in order with using the add button?

1 Reply

Avatar

Level 7

For the period numbers I would create a variable called 'count' in form properties and set the initial value to 0. Then in the click event of the add row button put (in formcalc):

count = count + 1

Row1.instanceManager.addInstance(1)

Row1[count].NumericField1 = count + 1

You could use the same logic (using count as the index to your rows) to add up your payments.