Answered
I have two DateTime Fields on a PDF. I just want the user to enter a time such as 2:15 in one box, and have the other box auto display 2:45. I've looked at lots of examples, and can not get anything working. Help please!
(I know the formula below is wrong - I've tried a lot of variations, and simplified it here to show what I'm trying to do ... I just need a simple example of what the formula should be.
topmostSubform.Page1.MyDateTimeField2::exit - (FormCalc, client)
if ($.rawValue <> null)then
MyDateTimeField3.formattedValue = Num2Time(MyDateTimeField2.value + 30, "HH:MM")
endif
if (HasValue($))then
MyDateTimeField3.rawValue = Num2Time(Time2Num($.formattedValue, "HH:MM") + (30 * 60 * 1000), "HH:MM")
endif
In simpler format:
// default value if no entry or entry cleared
MyDateTimeField3.rawValue = null
// if we have a time entered
if (HasValue($))then
// get time in milliseconds
var nTime = Time2Num($.formattedValue, "HH:MM")
// add 30 minutes in milliseconds
nTime = nTime + (30 * 60 * 1000)
// convert milliseconds to HH:MM
MyDateTimeField3.rawValue = Num2Time(nTime, "HH:MM")
endif
George Kaiser