These forums are now Read Only. If you have an Acrobat question, ask questions and get help from one of our experts.

FormCalc HELP!

Silverhairster
Registered: Nov 4 2009
Posts: 3

Not a programmer so this may be very basic. Can someone supply me the correct code for adding the content of a number of cells and display it in another!

DayTotal = sum(Extension01 + Extension02 + Extension03 + Extension04 + Extension05 + Extension06 + Extension07 + Extension08 + Extension09 + Extension10)

The above is where I am and have not a clue what to do next. I am a graphic designer given this form task and am at sea when it comes to programming.

Thanks!
Tom Clark

My Product Information:
LiveCycle Designer, Windows
radzmar
Expert
Registered: Nov 3 2008
Posts: 1202
The function sum uses comma's to separate the values from each other.

You can put the script directly into the caclulation event of that field, that should display the sum.
$.rawValue = Sum(Extension01 , Extension02, Extension03, Extension04)

radzmar
LoveCycle Blog
Documents you need:
LiveCycle Designer ES2 Docs

gkaiseril
Expert
Registered: Feb 23 2006
Posts: 4308
'Sum' is a function and takes a series of parameters that are the numbers to be added. You need to use the parameter separator character, ',', and not the addition operator, '+'.

LiveCycle Designer has a 'Scripting Reference' under the 'Help' menu option. This document provides some coding examples and describes how to write FormCalc. There are also tutorials on this site in text and video about using LiveCycle Designer and writing scripts.

George Kaiser

Silverhairster
Registered: Nov 4 2009
Posts: 3
Keep getting the following error message: Error: accessor "Extension01" is unknown ... with this code in place or any I have tried.
radzmar
Expert
Registered: Nov 3 2008
Posts: 1202
Well, the script does not know what's the accessor "Extension01".
You can create variables that you use for the calculation..

Example:
var Ext01 = xfa.resolveNode("form1.#subform.Extension01").rawValuevar Ext02 = xfa.resolveNode("form1.#subform.Extension02").rawValue $.rawValue = Sum(Ext01, Ext02)

radzmar
LoveCycle Blog
Documents you need:
LiveCycle Designer ES2 Docs