Timesheet - Date Population

Avatar

Avatar

gibsonlr

Avatar

gibsonlr

gibsonlr

11-03-2010

Hey -
I am working on a semi-monthly timesheet form where the user will enter the period ending date. I'd like for the day of the month fields (1st, 2nd, etc) and the day of the week fields (M, T, W, etc) to auto-populate if possible. I am open to having the user enter both the period start date and period end date if necessary. I'm using Livecycle and most of the posts I've read regarding this are counting the number of days in between. The biggest issue I'm having is that the number of days in the pay period are different depending on the month. The PP ends the 1st and 16th. Any suggestions you have would be great - Thanks!

Accepted Solutions (0)

Answers (1)

Answers (1)

Avatar

Avatar

Steve_L_Walker

Total Posts

1.4K

Likes

197

Correct Answer

212

Avatar

Steve_L_Walker

Total Posts

1.4K

Likes

197

Correct Answer

212
Steve_L_Walker

12-03-2010

How about something like this?

The image, below, is a table where the first column is called 'date'. After you pick the date for row 0 (highlighted in yellow), the dates for the previous 7 days are calculated. The nice thing is that FormCalc takes care of calculating the dates correctly.

// form1.page1.subform1.table_.row_[0].date::exit - (FormCalc, client)

var dayNum = Date2Num($.formattedValue,"MM/DD/YYYY")

row_[1].date.rawValue = Num2Date(dayNum-1,"MM/DD/YYYY")

row_[2].date.rawValue = Num2Date(dayNum-2,"MM/DD/YYYY")

row_[3].date.rawValue = Num2Date(dayNum-3,"MM/DD/YYYY")

row_[4].date.rawValue = Num2Date(dayNum-4,"MM/DD/YYYY")

row_[5].date.rawValue = Num2Date(dayNum-5,"MM/DD/YYYY")

row_[6].date.rawValue = Num2Date(dayNum-6,"MM/DD/YYYY")

p.png

Steve