Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Supress data on PUblic Holidays

Status
Not open for further replies.

sunisree

Programmer
Jul 22, 2003
4
US

HI!,

I have a date(start date) and i display the records staring from the start date upto 4 weeks. I want to supress the data in that particular coulumn where the task has the dates of memorial day or labour day or thanks giving as they keep on changing. iwas able to supress them on July 4th, Dec 25 and Jan 1st. PLease do let me know if there is an short wayof doing it as i have done long process and i think it might hinder the performance.

Thanks in advance
 
If you have control of the data, you could set up a new table showing public holidays.

Otherwise do a logic function in which you hard-code all of them. You need only do this once, in a formula field with a name like Public_Holidays and you test it wherever necessary. It can even be copied from report to report using cut-and-paste

Madawc Williams
East Anglia, Great Britain
 
If you use Mawdawc's Public Holidays table approach, consider taking a data warehouse approach and do more than just Holidays. Create a table of all dates, with flags to identify business days, weekends, holidays, month, quarter, fiscal month, fiscal quarter, etc.

As for the latter, here's an example from Ken Hamady that might prove useful:


-k
 
I have an alternative formula to Ken's, using the DateDiff function and creating an array of Holiday dates.

I use this when training staff as it uses a functions that people generally need help on......

WhilePrintingRecords;
//Set the values of Start Date and End Date
DateVar StartDate := Date(2003,01,01);
DateVar EndDate := Date(2003,12,31);

//Find out the difference in days and subtract the weekends
NumberVar DaysDiff := DateDiff("d",StartDate,EndDate) -
DateDiff("ww",StartDate,EndDate,crsaturday) -
DateDiff("ww",StartDate,EndDate,crsunday);

//Create an array of Holiday dates
Local DateVar Array Holidays := MakeArray(
Date(2003,01,01),
Date(2003,01,02),
Date(2003,12,25),
Date(2003,12,26),
Date(2003,07,07));

//Loop through the array checking if each holiday is within the dates
Numbervar Counter := 0;
While UBound(Holidays) <> Counter do
(Counter := Counter + 1;
if Not(dayofweek(Holidays[Counter]) in [1,7]) and
Holidays[Counter] in StartDate to EndDate then DaysDiff := DaysDiff -1;);

//Display result to 0 decimal places and no thousand separator
totext(DaysDiff,0,&quot;&quot;);

Just replace the items in bold with you start and end date fields and the items in italics with your holiday dates.

Reebo
Scotland (Sunny with a Smile)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top