These forums are now Read Only. If you have an Acrobat question, ask questions and get help from one of our experts.

Sum calculation with a maximum allowed total.

phornung2
Registered: Mar 2 2010
Posts: 23
Answered

Hello,
 
I was wondering if someone could tell me if an IF statement in a Formcalc expression would work if you wanted to establish a maximum amount for a field that totals (Sums) other fields. For example, if I wanted to total fields 1a, 1b, 1c, and 1d, is there anything that you could do to prevent a total greater than a specified amount.
 
I do not want to replace what they enter in the specific fields or display some sort of validation message, only the total. So, let's say the maximum total is 500. If the user enters figures in the given fields, but exceeds the maximum amount, only the maximum anount would be displayed in the total field.
 
I hope this makes sense. Thanks in adavnce for any recommendations or examples.

My Product Information:
LiveCycle Designer, Windows
radzmar
Expert
Registered: Nov 3 2008
Posts: 1202
Accepted Answer
Hi,

here an example of how the calculation could look like in FormCalc.
  1. var Total = Sum(a1, a2, a3, a4)
  2.  
  3. if (Total lt 500) then
  4. $ = Total
  5. else
  6. $ = 500
  7. endif

radzmar
LoveCycle Blog
Documents you need:
LiveCycle Designer ES2 Docs

phornung2
Registered: Mar 2 2010
Posts: 23
Marcus,

Thank you so much. Works perfectly. I just wasn't stating the FormCalc expression properly. Appreciate your help.