Discussions
Categories
Choose a Product
THRUST SERVICES
CORE APPS
CE PRODUCTS
...
Quick Links
POPULAR
HELPFUL TIPS
Groups
My Links
FOR SIGNED IN MEMBERS:
Back to website
Home
Designing Analytics Reports
time zone correction script in initialize executing multiple times
Migrateduser
Hello All,
I am working on optimizing some reports which have time zone correction scripts in the initialize event in the report, which by definition initialize script would execute multiple times for every page. I tried putting time zone script in before factory but it didnt . where does the timezone related script go for efficient and optimized execution of the report.
Thanks
Abhishek
Code:
startDate = reportContext.getParameterValue("startDate");
endDate = reportContext.getParameterValue("endDate");
endDate = DateTimeSpan.addTime(endDate,23,59,59);
var tz = reportContext.getAppContext().get("AppRuntimeTimeZone");
if ( tz == null ) {
zone = "America/New_York";
tz = java.util.TimeZone.getTimeZone(zone);
}
else {
zone = tz.getID();
}
offset = tz.getOffset(new java.util.Date().getTime());
offset /= 60000;
offset = -offset;
var today = BirtDateTime.today();
if (offset != 0) {
startDate = BirtDateTime.addHour(startDate,offset/60);
startDate = BirtDateTime.addMinute(startDate,offset % 60);
endDate = BirtDateTime.addHour(endDate,offset/60);
endDate = BirtDateTime.addMinute(endDate,offset % 60);
}
dateRange = DateTimeSpan.days(startDate,endDate);
if (dateRange < 3) {
chartType = "hours";
}
else if (dateRange > 60) {
chartType = "weeks";
}
else {
chartType = "days";
}
startDate=Formatter.format(startDate,"yyyy-MM-dd HH:mm:ss");
endDate=Formatter.format(endDate,"yyyy-MM-dd HH:mm:ss");
Find more posts tagged with
Comments
There are no comments yet