I am a novice user of Adobe Livecycle but learning. I am creating an expense voucher for employees to be reimbursed for mileage however I would like to create a if statement that says if the expense date is equal to or before June 30, 2012 then multiply the number of miles drived by a rate of $0.555 per mile and if the expense rate is equal to or after July 1, 2012 then multiply the number of miles by a rate of $0.600 per mile. I have created specific fields labeled dteexpenseDate (field with user entered date), decnumberMiles (number of miles driven) and decmileageRate (mileage rate).
Currently, I have this code;
var currentDate = Date2Num(dteexpenseDate.rawValue = "2012-06-30")
var expenseDate = Date2Num(dteexpenseDate.rawValue, "YYYY-MM-DD")
var expenseTest = expenseDate - currentDate
I am assuming you want to populate the last of the 3 fields (mileage rate)? If so, use the calculate event in formCalc with something like
var changeDate = Date2Num( "2012-07-01", "YYYY-MM-DD" ) var expenseDate = Date2Num( dteexpenseDate.rawValue, "YYYY-MM-DD" ) var expenseTest = expenseDate - changeDate if ( expenseTest < 0 ) then $ = decnumberMiles * 0.555 else $ = decnumberMiles * 0.600 endif
That worked! Thank you very much.