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

Checking two fields for values then dividing livecycle 8.0

ndjustin20
Registered: Oct 7 2009
Posts: 21

i am trying to do this

if(HasValue(NumericField13) && HasValue(NumericField13))then
var rent = NumericField13.rawValue;
var sqft = NumericField27.rawValue;
NumericField28.rawValue = rent / sqft;
else
NumericField28.rawValue = "0";

I keep getting a parse error and it's becuase i am trying to check both fields for values though i'm not sure how else to do this as that's what I need the if statment to check.

Justin

jonom
Registered: Jan 31 2008
Posts: 133
You're mixing some Javascript with your Formcalc - the main thing is the && should be a single & and you don't need semicolons and you missed the "endif" at the end. And in your sample you're checking NumericField13 twice - tested the following out and it works:I put it on the calculate event of NumericField28

if (HasValue(NumericField13) & HasValue(NumericField27)) then
var rent = NumericField13.rawValue
var sqft = NumericField27.rawValue
NumericField28.rawValue = rent / sqft
else
NumericField28.rawValue = 0
endifOr this is a little shorter!

if (HasValue(NumericField13) & HasValue(NumericField27)) then
$ = NumericField13 / NumericField27
else
$ = 0
endif