I am assuming this is a basic calculation question. New to Adobe LiveCycle Forms.
I have a simple form containing a table. The table appears as such:
Text | Formatted as Date/Time Fields | Header 3 |
---|---|---|
Monday | user wil choose the beginning date (Date/Time) this is DateTimeField1 | |
Tuesday | this should calculate DateTimeField1 + 1 | |
Wednesday | this should calculate DateTimeField1 + 2 | |
Thursday | this should calculate DateTimeField1 + 3 | |
Friday | this should calculate DateTimeField1 + 4 | |
Saturday | this should calculate DateTimeField1 + 5 | |
Sunday | this should calculate DateTimeField1 + 6 |
Calculations are performed after the date is chosen for Monday. My mind tells me the simple calculation of DateTimeField1 + 1 is not going to work (and in fact doesn't!) as it needs to change Monday to a number first. I saw on another thread the following:
Num2Date(Date2Num(Date(DateTimeField1), "DD.MM.YYYY")+7, "DD.MM.YYYY")
Thought this was going to get me close. No cigars though!
Any quick help is greatly appreciated. And since I am new to this, details about what needs to be changed would be great too!
Thanks
Views
Replies
Total Likes
The attached calculates dates for next six days starting Monday. It forces the start day to be a Monday also.
// form1.page1.mon::exit - (FormCalc, client)
var dayNum = Date2Num($.formattedValue,"MM/DD/YYYY")
form1.page1.dayOfWeek.execCalculate()
if (dayOfWeek.rawValue == "Mon") then
tues.rawValue = Num2Date(dayNum+1,"MM/DD/YYYY")
wed.rawValue = Num2Date(dayNum+2,"MM/DD/YYYY")
thurs.rawValue = Num2Date(dayNum+3,"MM/DD/YYYY")
fri.rawValue = Num2Date(dayNum+4,"MM/DD/YYYY")
sat.rawValue = Num2Date(dayNum+5,"MM/DD/YYYY")
sun.rawValue = Num2Date(dayNum+6,"MM/DD/YYYY")
else
xfa.host.messageBox("The selected date is not a Monday.")
tues.rawValue = null
wed.rawValue = null
thurs.rawValue = null
fri.rawValue = null
sat.rawValue = null
sun.rawValue = null
endif
Steve
Views
Replies
Total Likes
Here an addition for you date field.
This FormCalc script in the exit:Event will check it the selected date is on a monday.
If not it will go the days back until the last monday.
Hope this helps, too.
Views
Replies
Total Likes