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

calculations in live cycle designer es

Avatar

Level 2

Hi,

I'm trying to read through the Adobe Live Cycle Designer book but totally lost when it comes to the formulas.  I have a dynamic form --its going to be many pages -- that uses drop down boxes with points 1, 3, 5.  If the user has three fields to review, and enters 1, 3, 5 in each.  I need to have a Total field that adds up to 9.  I can't figure out the syntax on how to set it up.

Page two of file:

Field 1, named Workplace

Field 2, named Privacy

Field 3, named Ownership.

Kathleen

1 Accepted Solution

Avatar

Correct answer by
Level 10

Hi,

If all four objects are in the same subform, then it is easier to reference. In the calculate event of the total object you would have the following javascript:

this.rawValue = Workplace.rawValue + Privacy.rawValue + Ownership.rawValue;

You would get the same result in FormCalc using this:

$ = Workplace + Privacy + Ownership

This is on the basis that the three dropdowns have bound values set in the Bindings tab, or that their display value is "1", "3" and "5".

One way to easily reference objects when you are in the script editor is to press and hold the control key and then click on the object you want to reference, this will insert the reference (include subform names if necessary).

Good luck,

Niall 

View solution in original post

4 Replies

Avatar

Correct answer by
Level 10

Hi,

If all four objects are in the same subform, then it is easier to reference. In the calculate event of the total object you would have the following javascript:

this.rawValue = Workplace.rawValue + Privacy.rawValue + Ownership.rawValue;

You would get the same result in FormCalc using this:

$ = Workplace + Privacy + Ownership

This is on the basis that the three dropdowns have bound values set in the Bindings tab, or that their display value is "1", "3" and "5".

One way to easily reference objects when you are in the script editor is to press and hold the control key and then click on the object you want to reference, this will insert the reference (include subform names if necessary).

Good luck,

Niall 

Avatar

Level 2

Hi Niall,

Amazing! I did this report in Excel with all kinds of calc's, error messages, etc., but the users didn't like that the fields couldn't expand with their texting (had to lock the form to keep them form messing with it). So here I am trying to figure out Adobe under a ticking timeclock. Ugh! Anyway, finally figured out how to make the formula work based on what you gave. THANK YOU!   W

hat happens if there are other fields that need to be included on other pages? Reference each sheet within the formula?

HIRE.SECTION1CONTINUED.total::calculate - (FormCalc, client)

$ = Sum(WORKPLACEPOINTS,SAFETYPOINTS,PRIVACYPOINTS,OWNERSHIPPOINTS)

And the next page...

HIRE.SECTIONONE.total::calculate - (FormCalc, client)

$ = Sum(attitudepoints,appearancepoints,commitmentpoint,communicationpoints,customerpoints)

Avatar

Level 10

Hi,

My personal preference is to use Javascript was scripting. I tend to use FormCalc for calculating dates, etc. As a result I sometimes forget the range of inbuilt functions in FormCalc.

Your use of the sum is a timely reminder...

When referencing objects it is important that you give the full reference (or the minimum reference relative to the two objects). What I am trying to say is that if the two objects are in the same subform, then you can just use the object names (as you are doing). But if the objects are in different subforms or different pages, then you need to give a fuller reference.

It raises one point - it is good practice to name objects as you are going. Clearly all of your objects are named and subforms (HIRE). But you should also name pages, eg page1. This makes it easier to reference.

The easiest way to reference objects in your script is to press Control and then click the object you want to reference. This will insert just the right amount of reference into the script for you.

For example if the two objects are in the same subform:

$ = SAFETYPOINTS

But if SAFETYPOINTS was on a different page (page4) and in a subform (HIRE), then the script would be:

$ = page1.HIRE.SAFETYPOINTS

Hope that helps,

Niall

Avatar

Level 2

It does VERY MUCH! Thank you.

Sincerely,

Kathleen

Kathleen Kearns

Senior Benefits Analyst

Human Resources

Resurrection Health Care | St. Joseph Hospital | 2913 N. Commonwealth | Chicago, IL 60657

Phone: 773-665-6282 | Fax: 773-665-3410 | Email: kkearns@reshealthcare.org

Confidentiality Notice: This e-mail message, including any attachments, is for the sole use of the intended recipient(s) and may contain confidential and privileged information. All personal messages express views solely of the sender, which are not to be attributed to Resurrection Health Care. Unauthorized review, use, disclosure or distribution is prohibited. If you are not the intended recipient, please contact the sender by reply e-mail and destroy all copies of the original message.