Expand my Community achievements bar.

Don’t miss the AEM Skill Exchange in SF on Nov 14—hear from industry leaders, learn best practices, and enhance your AEM strategy with practical tips.
SOLVED

Calculation Script on page 2 with data from page 1?

Avatar

Former Community Member

I am missing something simple here.. I am wanting to write a calculation script using the sum of two numeric fields on page one divided by the sum of two numeric fields on page two. The only thing I can get to work is if I do a numeric field on page one and do the sum calculation there. Then if I move it down to page two it is just blank. What am I missing?

1 Accepted Solution

Avatar

Correct answer by
Level 10

Hi,

You can achieve this, you just need to reference the fields properly.

First, make sure that you have named both pages. Leaving pages/subforms (and objects) unnamed makes it more difficult to reference in script.

There is a handy trick when you are in the Script Editor. Hover the mouse over another object and press/hold Control. The mouse will change into a 'V'. Still holding Control click the object, and LC Designer will insert the reference into the script. This is easy enough when the objects are close, so do a bit of practice. If the objects on are on different pages, then you need to scroll down to the object you want to reference, activate the Script Editor again and then click the object with Control held.

Here is an example for referencing objects: http://www.assuredynamics.com/index.php/category/portfolio/referencing-objects/

Hope that helps,

Niall

Assure Dynamics

View solution in original post

2 Replies

Avatar

Correct answer by
Level 10

Hi,

You can achieve this, you just need to reference the fields properly.

First, make sure that you have named both pages. Leaving pages/subforms (and objects) unnamed makes it more difficult to reference in script.

There is a handy trick when you are in the Script Editor. Hover the mouse over another object and press/hold Control. The mouse will change into a 'V'. Still holding Control click the object, and LC Designer will insert the reference into the script. This is easy enough when the objects are close, so do a bit of practice. If the objects on are on different pages, then you need to scroll down to the object you want to reference, activate the Script Editor again and then click the object with Control held.

Here is an example for referencing objects: http://www.assuredynamics.com/index.php/category/portfolio/referencing-objects/

Hope that helps,

Niall

Assure Dynamics

Avatar

Former Community Member

Thanks so much for the fast reply! This was driving me crazy!