Jeremiah31
Programmer
I tried searching on the forum, if I overlooked the answer please forgive.
When I input my starting date value and leave the end as current date, the total number of working days is a six digit number.
The Start date is based on a three digit (numeric value) concaterize as a date value
Date({iSeriesSQL_FADC_Unfianlized_Keyrec_Trailer.INYRYEAR},
,{iSeriesSQL_FADC_Unfianlized_Keyrec_Trailer.INYRMO},
,{iSeriesSQL_FADC_Unfianlized_Keyrec_Trailer.INYRDA});
I think the problem has to do with formula for start date, I'm a little lost in what to do.
WhilePrintingRecords;
//Set the values of Start Date and End Date
DateVar StartDate := Date({iSeriesSQL_FADC_Unfianlized_Keyrec_Trailer.INYRYEAR},{iSeriesSQL_FADC_Unfianlized_Keyrec_Trailer.INYRMO},{iSeriesSQL_FADC_Unfianlized_Keyrec_Trailer.INYRDA});
DateVar EndDate := CurrentDate();
//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(2007,01,01),
Date(2007,01,02),
Date(2007,12,25),
Date(2007,12,26),
Date(2007,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,"");
When I input my starting date value and leave the end as current date, the total number of working days is a six digit number.
The Start date is based on a three digit (numeric value) concaterize as a date value
Date({iSeriesSQL_FADC_Unfianlized_Keyrec_Trailer.INYRYEAR},
,{iSeriesSQL_FADC_Unfianlized_Keyrec_Trailer.INYRMO},
,{iSeriesSQL_FADC_Unfianlized_Keyrec_Trailer.INYRDA});
I think the problem has to do with formula for start date, I'm a little lost in what to do.
WhilePrintingRecords;
//Set the values of Start Date and End Date
DateVar StartDate := Date({iSeriesSQL_FADC_Unfianlized_Keyrec_Trailer.INYRYEAR},{iSeriesSQL_FADC_Unfianlized_Keyrec_Trailer.INYRMO},{iSeriesSQL_FADC_Unfianlized_Keyrec_Trailer.INYRDA});
DateVar EndDate := CurrentDate();
//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(2007,01,01),
Date(2007,01,02),
Date(2007,12,25),
Date(2007,12,26),
Date(2007,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,"");