Excluding Holidays [message #1847335] |
Sat, 23 October 2021 01:55 |
Eclipse User |
|
|
|
Hello,
I am trying to figure out how to exclude Holidays from a diffDays.
This is current expression I am using to exclude the weekends. Below is the ticket I found the below expression on.
https://www.eclipse.org/forums/index.php/t/1066425/
var daysToExcludeCount = 0;
var totalDaysFull = parseInt(BirtDateTime.diffDay(params["CompleteMTDStart"].value, params["CompleteMTDEnd"].value)) + 1;
var day = params["CompleteMTDStart"].value;
for(var x=0; x<totalDaysFull; x++){
if(BirtDateTime.weekDay(day, 1) == 1 || BirtDateTime.weekDay(day, 1) == 7){
daysToExcludeCount++;
}
day = BirtDateTime.addDay(day, 1);
}
var totalDaysModified = totalDaysFull - daysToExcludeCount;
totalDaysModified;
For example I would like to exclude Thanksgiving.
I am assuming I would need it to be something as follows.
var holidaysToExcludeCount = 0;
var daysToExcludeCount = 0;
var totalDaysFull = parseInt(BirtDateTime.diffDay(params["CompleteMTDStart"].value, params["CompleteMTDEnd"].value)) + 1;
var day = params["CompleteMTDStart"].value;
for(var x=0; x<totalDaysFull; x++){
if(BirtDateTime.weekDay(day, 1) == 1 || BirtDateTime.weekDay(day, 1) == 7){
daysToExcludeCount++;
}
day = BirtDateTime.addDay(day, 1);
}
var days = params["CompleteMTDStart"].value;
for(var y=0; y<totalDaysFull; y++){
if((BirtDateTime.dayOfYear(days) == '329'),1){
holidaysToExcludeCount++;
}
days = BirtDateTime.addDay(day, 1);
}
var totalDaysModified = totalDaysFull - daysToExcludeCount - holidaysToExcludeCount;
totalDaysModified;
Any help would be appreciated! (This is so I can run the report automatically instead of having a user manually run the report every morning.)
Thank you!
|
|
|
Powered by
FUDForum. Page generated in 0.03172 seconds