Expand my Community achievements bar.

Guidelines for the Responsible Use of Generative AI in the Experience Cloud Community.

How can I calculate the sum of the first two rows in a table?

Avatar

Level 2

I have a table with a repeating row that, when data is merged, always has three rows:

Support type 11,234,456
Support type 2221,556
Interest11.222

I have a field where I want to show the sum of Support types 1 and 2.

I do not want to add the interest to this.

I'm using FormCalc with the following script on the calculate event of the Total field, which is in the same subform but not in the table:

data.JP_Page1.subform_Hidden.sub_SupportTotals.NumericField1::calculate - (FormCalc, client)

$.rawValue = Sum(subform_Hidden.sub_SupportTotals.tbl_SupportSubtotals.DataRow[0].SUBTOTAL,  subform_Hidden.sub_SupportTotals.tbl_SupportSubtotals.DataRow[1].SUBTOTAL)

I've tried this using both decimal and numeric field types, neither work.

I feel like I must be hitting a syntax issue, but the code checker isn't exposing it.

Can anyone help me figure out what is wrong with my script?

Thanks!

Janet

2 Replies

Avatar

Level 10

You don't need to do Sum for this, you should use Sum for all rows purpose only..

$.rawValue = subform_Hidden.sub_SupportTotals.tbl_SupportSubtotals.DataRow[0]. SUBTOTAL +  subform_Hidden.sub_SupportTotals.tbl_SupportSubtotals.DataRow[1].SUBT OTAL

Avatar

Level 2

That didn't work either. Sad face!

I have solved the problem by asking the developer I am working with to perform the calculation prior to the data merge with the layout.

But I'd really like to figure out why I can't do it in the form, because I should be able to.