We help IT Professionals succeed at work.
Get Started

Create view with a date range seperating each date by month

kali958
kali958 asked
on
510 Views
Last Modified: 2013-12-18

I have an attendance database that tracks associates times out of the office. Currently I do monthly reports by the start date of the request. That is fine for some areas, but others are running into an issue.

When someones time off runs over two months, they want to be able to seperate out that request to reflect the correct time off during the month. For example. Someone takes vacation from 6/28/2010 to 07/09/2010 and return on 7/12.

I have the code right now that will explode the dates and subtract out the weekends and holiday to get the correct number of days off. So, this would be a total days of 9 days out of the office, minus Sat. Sun and the observed holiday on 7/5.

I need to be able to create view or something, so that it would display the correct time used each month.  So it would say for June that the associate used 24 hours and in July they used 48 hours.  

I have a field right now to calulate the days with the code:

tDateRange := @Date(@TextToTime(@Text(DISP_Start) + "-" + @Text(DISP_END)));
tHolidayList := "01/01/2010":"05/31/2010":"07/05/2010":"09/06/2010":"11/25/2010":"12/24/2010":"01/01/2011";
tDateList := @If(tDateRange = ""; ""; @Date(@TextToTime(@Explode(tDateRange))));
tWeekday := @Text(@Weekday(tDateList));
tWkDayDate := tWeekday + "^" + @Text(tDateList);
tSats := @Right(tWkDayDate; "7^");
tSuns := @Right(tWkDayDate; "1^");
tList := @Trim(@ReplaceSubstring(@Text(tDateList); tSats : tSuns; ""));
tDays := @Trim(@Replace(tList; tHolidayList; ""));
@TextToTime(@Text(tDays))

But now I am struggling with how to extract the month from the list and have it display correctly. Each time I try to get the month to extract from this, I get either a Text Expected error or it will only convert the first date in the list to the month and ignores the rest.

I am only having this issue on actual full days out of the office. Since Partial Day requests are same day, this function is not needed.

Any ideas? I appreciate the help as usual! Thanks
Comment
Watch Question
Commented:
This problem has been solved!
Unlock 1 Answer and 10 Comments.
See Answer
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE