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

Performing Math Calculations on A Form

Avatar

Level 2

I have a performance review form I want to do some basic math and have no idea where to start.  I looked in the help section for FormCalc and can't make heads or tails out of it.  Does anyone know where I can watch, download or read some resource to understand how I could get the form to multiply two different numeric fields to get a number.

Do you make reference to the object somehow in formcalc to say multiple this field by that field.  I can do it in Excel in a snap but the new language is throwing me off.  Heres what it would look like in an excel sheet for the formulas.

The areas where the numbers would be put in by the user would be numeric fields or a drop down list.  The form itself is attached as well.

1 Accepted Solution

Avatar

Correct answer by
Former Community Member

The formula is fine but you have the scripting language set to Javascript and that is a FormCalc formula. You can either set the language to FormCalc (top right corner of the scripting palette) or chang ethe formula to Javascript syntax:

this.rawValue = GW1.rawValue * GWPercent1.rawValue

Paul

View solution in original post

5 Replies

Avatar

Level 3

I'm not an expert, but Iknow the answer to your question.

On your form you've a field called

Weighted Score  You need to set the field value to Calculate Read

in the Object tab.

From the script pane select Calculate and type:  G1 * G1Percent

 

Avatar

Level 2

I tried your work up but it did not calculate, here is the change

Avatar

Correct answer by
Former Community Member

The formula is fine but you have the scripting language set to Javascript and that is a FormCalc formula. You can either set the language to FormCalc (top right corner of the scripting palette) or chang ethe formula to Javascript syntax:

this.rawValue = GW1.rawValue * GWPercent1.rawValue

Paul

Avatar

Level 2

Thanks Paul, as usual your sagely advice has worked.  Can you recommend any resources that show you how to write formulas and calculations in both JavaScript and FormCalc?

Avatar

Former Community Member

Just do a Google search on LiveCycle Designer Books and you will see many options that will describe the details of Designer for you.

Paul

The following has evaluated to null or missing: ==> liqladmin("SELECT id, value FROM metrics WHERE id = 'net_accepted_solutions' and user.id = '${acceptedAnswer.author.id}'").data.items [in template "analytics-container" at line 83, column 41] ---- Tip: It's the step after the last dot that caused this error, not those before it. ---- Tip: If the failing expression is known to be legally refer to something that's sometimes null or missing, either specify a default value like myOptionalVar!myDefault, or use <#if myOptionalVar??>when-present<#else>when-missing. (These only cover the last step of the expression; to cover the whole expression, use parenthesis: (myOptionalVar.foo)!myDefault, (myOptionalVar.foo)?? ---- ---- FTL stack trace ("~" means nesting-related): - Failed at: #assign answerAuthorNetSolutions = li... [in template "analytics-container" at line 83, column 5] ----