PDF Editing Issues

How to Sum Nonempty Fields in Adobe LiveCycle Designer

Chanuka GeekiyanageChanuka Geekiyanage Nov 2, 2026 868 views

Question details

The user needs to calculate the sum of consecutive numeric or currency fields in a LiveCycle form while ignoring null or empty cells, and is looking for an efficient alternative to writing a loop-based script.

How to Sum Nonempty Fields in Adobe LiveCycle Designer
Product
Adobe LiveCycle Designer
Device & OS
not provided
Scenario
Creating an interactive PDF form that automatically totals a column of numbers, even if some of the input fields are left blank.
Observed behavior
Standard JavaScript calculations often require loops and conditional checks to bypass empty cells, prompting the user to seek a more straightforward summation method.
Before you start

Ensure you have your form open in Adobe LiveCycle Designer and know the exact exact hierarchical names of the rows and cells you intend to calculate.

Solution 1Recommended

Use FormCalc Sum Method with a SOM Expression

Utilize LiveCycle Designer's built-in FormCalc language, which automatically handles empty cells without requiring a complex loop script.

In Adobe LiveCycle Designer, relying on complex JavaScript loops is usually unnecessary for basic addition. FormCalc provides a built-in Sum() method that can efficiently add up fields by utilizing a generic Scripting Object Model (SOM) expression.

When using this method, FormCalc inherently ignores null or empty fields, preventing calculation errors and keeping your form logic clean.

1
Select the Total Field

Open your form in Adobe LiveCycle Designer and click on the specific numeric or currency field where you want the final sum to be displayed.

2
Open the Script Editor

Navigate to 'Window' in the top menu bar and select 'Script Editor' to reveal the calculation entry panel.

3
Configure Script Settings

At the top of the Script Editor, set the 'Language' dropdown to 'FormCalc' and ensure the 'Run At' dropdown is set to 'Client'.

4
Input the SOM Expression

Type the formula: $ = Sum(RowName[*].CellName). Replace 'RowName' with the actual name of your repeating row and 'CellName' with the name of the numeric field you wish to sum. The asterisk (*) tells the form to check every instance of that row.

Use FormCalc Sum Method with a SOM Expression
Community Support: If you must use JavaScript due to specific form requirements, it is recommended to consult the Adobe LiveCycle/Experience League community for tailored scripting advice.
Free Microsoft Office alternative

Try WPS Office for Standard PDF Form Viewing and Editing

While Adobe LiveCycle Designer is specialized for complex XFA (XML Forms Architecture) forms, WPS Office provides a lightweight, highly compatible alternative for handling standard AcroForms, PDF editing, and everyday office tasks.

Easily fill, sign, and manage standard interactive PDF formsFully compatible with Microsoft Word, Excel, PowerPoint, and standard Adobe PDF formatsLightweight installation with an intuitive, familiar user interfaceFree to use for everyday document creation and editing
microsoft office alternative - wps office

Frequently Asked Questions

Why do empty cells cause errors in JavaScript form calculations?

In JavaScript, adding a null or blank text field to a number can result in 'NaN' (Not a Number) or cause string concatenation instead of mathematical addition. This is why JavaScript calculations usually require explicit checks for empty values before adding.

Can I use standard AcroForms instead of LiveCycle Designer?

Yes. If your form does not require dynamic, expanding XML data structures (XFA), standard AcroForms are much more widely supported across PDF readers, including WPS Office, and rely on standard JavaScript for calculations.

Does FormCalc work in all PDF viewers?

No. FormCalc is specific to Adobe's XFA architecture (LiveCycle/AEM Forms). Forms built with FormCalc generally require Adobe Acrobat or Adobe Reader to function properly and may not calculate correctly in third-party or web-based PDF viewers.

How do I reference multiple rows in a LiveCycle SOM expression?

You can use an asterisk (*) within square brackets, such as RowName[*], to instruct the form to reference all instantiated versions of that specific row in your hierarchy.