Expand my Community achievements bar.

Enhance your AEM Assets & Boost Your Development: [AEM Gems | June 19, 2024] Improving the Developer Experience with New APIs and Events
SOLVED

Adobe LiveCycle Calculation Help for a Specific Formula

Avatar

Level 1

Hoping to get some help on a calculation I need to input into LiveCycle:

 

Density Core Formula=(100-water-prot-fat-ash)/1.6+prot/1.4+ash/4.5+fat/0.93+water 

 

But unsure what to type into FormCalc to make this work ... 

@LiveCycle

1 Accepted Solution

Avatar

Correct answer by
Employee

It is actually pretty straight forward, using the calculate event I gave you the FormCalc and JavaScript variant. See here and you can open the PDF in Designer to get the script code

 

https://documentcloud.adobe.com/link/review?uri=urn:aaid:scds:US:a7fcaf0d-db8c-41db-ba31-bd3e14de1ad...

View solution in original post

3 Replies

Avatar

Correct answer by
Employee

It is actually pretty straight forward, using the calculate event I gave you the FormCalc and JavaScript variant. See here and you can open the PDF in Designer to get the script code

 

https://documentcloud.adobe.com/link/review?uri=urn:aaid:scds:US:a7fcaf0d-db8c-41db-ba31-bd3e14de1ad...

Avatar

Level 1

@Kosta_Prokopiu1  the calculation in my form defaults to 0.62 ... I think something is wrong ... 

Avatar

Employee

mine defaults to 62.5 when all values are 0 - if you don't want that you can surround it with an if statement. I just showed how to bring your formula to FormCalc or JavaScript.

if (water.rawValue <> null or prot.rawValue <> null or fat.rawValue <> null or ash.rawValue <> null) then
  (100-water.rawValue-prot.rawValue-fat.rawValue-ash.rawValue)/1.6+prot.rawValue/1.4+ash.rawValue/4.5+fat.rawValue/0.93+water.rawValue
else
  0
endif