Expand my Community achievements bar.

Enhance your AEM Assets & Boost Your Development: [AEM Gems | June 19, 2024] Improving the Developer Experience with New APIs and Events

FormCalc with 2 seperate table cells

Avatar

Level 3

How would you script this scenerio:

There are 2 tables, each with their own amount cell. These cells grow dynamically as user enter data in either of the table cells. A third table needs to sum these amount(s) in each cell in this manner > if Table_Two amount cell has value, then sum all Table_One and Table_Two amount cells, otherwise, only sum Table_One amount cell(s).

I am coding this using FormCalc in this manner:

if (HasValue(Table_Two.amount))then

Sum(Table_One[*].amount[*].rawValue)+ (Table_Two[*].amount[*].rawValue)

else

Sum (Table_One[*].amount[*].rawValue)

endif

Note: If I just use the Sum(Table_One[*].amount[*].rawValue) then this works. But when I add the other Table cell values as stated above, I get this error message:

Image9.PNG

And no values are being passed. Also note that Table_Two is initially hidden and is only instantiated when user click a button. Then user can add values into the table amounts.

Form can be found here: https://workspaces.acrobat.com/?d=oH2z1u0qR5tFswi9rRDnBQ (Botox_Template2)

Thanks in advance

Shai

0 Replies