Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
Bedrock Mission!

Learn more

View all

Sign in to view all badges

Adobe Summit 2023 [19th to 23rd March, Las Vegas and Virtual] | Complete AEM Session & Lab list
SOLVED

Java Script sum calculation

Avatar

Level 2

Hi I'm looking for help for what I suppose would be an easy question based on other posts I've read.

I'm new to livecycle ES and I have spent the better part of my adult life figuring out how to make new form fields appear after selecting a button.  Each entry has a "cost" numeric field (each with the same binding name) and at the bottom of the form I have a "total" num field which I want to display the sum of all the completed cost fields.  I have used a script that is supposed to sum up the same instance of the field name (ex. cost[*]) but it doesn't work.

Any help would be appreciated.

Stewb

1 Accepted Solution

Avatar

Correct answer by
Level 10

FormCalc provides coding brevity and functions that are very good for calculating table row and column totals.

For example, to calculate a row total.

// form.page1.budget.costs.row[0].total::calculate - (FormCalc, client)

$.rawValue = beer + food + other

For example, to calculate a column total.

// form.page1.budget.totalCosts.totals.food::calculate - (FormCalc, client)

$.rawValue = sum(form.page1.budget.costs.row[*].food)

Steve

View solution in original post

2 Replies

Avatar

Correct answer by
Level 10

FormCalc provides coding brevity and functions that are very good for calculating table row and column totals.

For example, to calculate a row total.

// form.page1.budget.costs.row[0].total::calculate - (FormCalc, client)

$.rawValue = beer + food + other

For example, to calculate a column total.

// form.page1.budget.totalCosts.totals.food::calculate - (FormCalc, client)

$.rawValue = sum(form.page1.budget.costs.row[*].food)

Steve

The ultimate experience is back.

Join us in Vegas to build skills, learn from the world's top brands, and be inspired.

Register Now