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.

Adding sum but fields are not recognized

Avatar

Level 4

In the attached example, I am simply trying to add the sum of the header rows in the sum cost field.

I used this script in the sum field: 

sum(NumericField2

+ NumericField5)

I get the error that the fields don't exist?

Is that the correct syntax?

3 Replies

Avatar

Former Community Member

You do not need the sum ....that woudl add a number of fields not just two. And you will probably have to path yourway to that field. The easiest way is to place the cursor in the script editor where you want the expression to reside, then hold down the ctrl key and point to the field you want to reference. The cursor will change to a V. Now click on the field and the correct field reference will be placed in the editor.

Paul

Avatar

Level 4

That's a great tip! Do you know how to find a percentage of a field? I looked in the FormCalc reference and I just saw how to calculate the APR of a loan....?

I just need one field to calculate the percentage of another field, such as 7%....if possible?

Avatar

Level 4

Percentage... 7% of: *7/100

Ceck also out your rows and the names... It would be easier for you to change the rows that have the same name.

Then check the original references to the specific fields (so that there are no [1]/[2]... in the names). (You can find them in the programming table. It looks like this:

form1.Subform9.Table1.Row7.NumericField5)

If you want to refer to Numeric Field 5 from a field that isn't in Row 7 you will have to use either the full name (this one is better) or at least ...Row7.NumericField5 (should normally work too; how much you have to overtake from the original name depends on how similar the original names are).

Hope that will help

Lisa