Expand my Community achievements bar.

Adding Calculations With Form Calc

Avatar

Former Community Member
I do not know anything about scripting, so please help if you can. It would be appreciated.

I have a form built with a colum of "numericfields". Call them 1 through 10. I need a "subtotal in numericfield 5. In numericfield 6, I need to calculate as a "percentage". Numericfileds 7 through 9 would be more additions/subtractions and the finally, numericfield 10 should be the total. I have tried everyway I can think of to come up with a calculation but am unable to do so.

It would be much like in excel. sum=a1:a5. Is there a way to build a spreadsheet in excel and have it converted to Designer and KEEP the formulas??



Thank you!

Jerry
5 Replies

Avatar

Former Community Member
Hi Jerry,



Here is a document that will help you out for scripting in FormCalc in Designer(see attachment).

Basic scripting for these situations could be something like this:



NumericField3.rawValue = NumericField1.rawValue + NumericField2.rawValue



This is placed in the calculate event of the 3rd Numeric Field.



Hope that helps,



Catherine

Avatar

Former Community Member
Hi Catherine,

I have basically (I think) the same question as Jerry. I read your answer, but still am having trouble getting my form to do what I want. Here's my situation:



I have six numeric fields (Binding name is "Amount" for each). I have a subtotal field (Binding name is "subtotal") which I want to calculate the 6 numeric fields. Each amount field is set to "User Entered-Optional", and the subtotal field is set to "Calculated-Read Only".



I'm trying the following script in the subtotal field with no success.



Sum(Amount[0], Amount[1], Amount[2], Amount[3], Amount[4], Amount[5])



Can you suggest what I am doing wrong? When I preview my PDF, I can enter numbers in the amount fields, but nothing shows up in the subtotal field.



Any help would be greatly appreciated.



Thanks,

Curtis

Avatar

Former Community Member
Catherine,



Thank you for the file and especially for your example!! I believe it will be of great help.



Jerry S. Morgan

Avatar

Former Community Member
It should be Sum(Amount[0].rawValue, Amount[1].rawValue....



Amount[*] is just an object, the rawValue is the actual numeric value it contains.



Chris

Adobe Enterprise Developer Support

Avatar

Former Community Member
Thanks Chris. It's just what I needed. I appreciate your help.



Curtis