Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Archived » BIRT » Excluding Holidays
Excluding Holidays [message #1847335] Sat, 23 October 2021 01:55
Tyler Chessum is currently offline Tyler ChessumFriend
Messages: 8
Registered: March 2018
Junior Member
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!
Previous Topic:org.eclipse.birt.report.engine.api.EngineException: Error happened while running the report.
Next Topic:BIRT 2.5.1: IReportDocument.getPageNumber(bookMark) returns wrong page number?
Goto Forum:
  


Current Time: Mon Apr 29 03:11:47 GMT 2024

Powered by FUDForum. Page generated in 0.02806 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top