on 09-11-2008 10:38 AM
Dear all,
I have created a report which calculates the averages for Month to date, year to date, last full working days week and last 4 working days week.
Now I would like to add another feature which is going to show me the records of last 5 rolling days, meaning if today is 11/09/2008, the report should get the data from 10/09/2008 to 04/09/2008 (6,7 skipped because of weekends).
I have tried using the formula like this
{lab_rework.rework_date} in ((date(year(currentdate),month(currentdate),day(Currentdate)-5)))
to
((date(year(currentdate),month(currentdate),day(Currentdate)-1)));
but this didn't work.
I then looked up on the help file and found out Last7Days however I am not sure how to use it to make it work with last 5 working days.
I am trying like this but this isn't working
{lab_rework.rework_date} in ((date(year(currentdate),month(currentdate),last7days-2)))
Any ideas?
Regards
Jehanzeb
Are you sure that is what you want? That still includes weekend days...
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
No brian, well yes the above formula does include weekends however, if you modify it like this
{lab_rework.rework_date} in Minimum(last7days)-1 to Maximum(Last7days)-1 and
not(dayofweek({lab_rework.rework_date}) in [1,7])
It would skip the weekends.
However, I am using a workingdays formula which looks for weekends and bank holidays, I needed the code to put it in the start date and end date.
Here is the workingday formula:
WhilePrintingRecords;
Local DateVar Start := ((minimum(last7days))-1);
Local DateVar End := ((Maximum(Last7days))-1);
Local NumberVar Weeks;
Local NumberVar Days;
Local Numbervar Hol;
DateVar Array Holidays;
Weeks:= (Truncate (End - dayofWeek(End) + 1 - (Start - dayofWeek(Start) + 1)) /7 ) * 5;
Days := DayOfWeek(End) - DayOfWeek(Start) + 1 +
(if DayOfWeek(Start) = 1 then -1 else 0) +
(if DayOfWeek(End) = 7 then -1 else 0);
Local NumberVar i;
For i := 1 to Count (Holidays)
do (if DayOfWeek ( Holidays<i> ) in 2 to 6 and
Holidays<i> in Start to End then
Hol:=Hol+1 );
Weeks + Days - Hol;
The above formula sort everything out.
The reason why I didn't post it initially was that it is irrelevant where it needs to go, all I wanted to know was how to get the last 5 days from the currentdate. Rest I knew how to do.
I hope this explains the scenario much better.
Regards
Jehanzeb
Ok I think I fixed it. I used this formula
{lab_rework.rework_date} in ((Minimum(last7days))-1) to((Maximum(Last7days))-1)
This gave me date from 04/09/2008 to 10/09/2008.
Sorted, I would say!
Regards
Jehanzeb
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
81 | |
9 | |
9 | |
7 | |
7 | |
6 | |
6 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.