Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Archived » BIRT » Get the Sundays ( dates) from a date range
Get the Sundays ( dates) from a date range [message #723933] Fri, 09 September 2011 22:25 Go to next message
KK  is currently offline KK Friend
Messages: 24
Registered: July 2011
Junior Member
I am looking to get all the sundays(the dates ex: 9/11/2011, 9/18/2011 etc) between a date range (ex: 09/01/2011 - 09/30/2011). I then want to group the report by this so I can aggregate the data for the week.
Please advise.
Re: Get the Sundays ( dates) from a date range [message #724568 is a reply to message #723933] Mon, 12 September 2011 15:07 Go to previous messageGo to next message
Jason Weathersby is currently offline Jason WeathersbyFriend
Messages: 9167
Registered: July 2009
Senior Member

Why not use the birtdatetime functions available in the expression
builder to add a computed column for week (1-52) and group on that?
Look at the two computed columns in the attached report.

Jason

On 9/9/2011 6:25 PM, KK wrote:
> I am looking to get all the sundays(the dates ex: 9/11/2011, 9/18/2011
> etc) between a date range (ex: 09/01/2011 - 09/30/2011). I then want to
> group the report by this so I can aggregate the data for the week.
> Please advise.
>
  • Attachment: weekday.zip
    (Size: 2.14KB, Downloaded 211 times)
Re: Get the Sundays ( dates) from a date range [message #726854 is a reply to message #724568] Mon, 19 September 2011 17:53 Go to previous messageGo to next message
KK  is currently offline KK Friend
Messages: 24
Registered: July 2011
Junior Member
OK thanks. I tried a variation of it. Still not much data in the db...will let you know about the outcome.
Re: Get the Sundays ( dates) from a date range [message #729749 is a reply to message #726854] Mon, 26 September 2011 22:06 Go to previous messageGo to next message
KK  is currently offline KK Friend
Messages: 24
Registered: July 2011
Junior Member
Hi Jason,
This does not work in my case...since I need to aggregate all amounts for week ending Sunday(including sunday)...every sunday. I just need to show the aggregated value and dont need to show the detail amounts for the rest of the week.
I tried your calculated column but when I grouped by it...it groups by all Sundays...and week number starts a new week on Sunday so misses out on Sunday values. please advise.
Re: Get the Sundays ( dates) from a date range [message #730077 is a reply to message #729749] Tue, 27 September 2011 15:22 Go to previous messageGo to next message
Jason Weathersby is currently offline Jason WeathersbyFriend
Messages: 9167
Registered: July 2009
Senior Member

You can always create a computed column using a Java util calendar like:

importPackage(Packages.java.util);
cl = new GregorianCalendar();
cl.setTime(row["ORDERDATE"]);
cl.setFirstDayOfWeek(Calendar.MONDAY);
cl.get(Calendar.WEEK_OF_YEAR);

You can set the first day of the week to whatever you want then drag the
dataset onto the report, group by week and put an aggregation element in
the group footer. Select the detail row and delete it.

Jason

On 9/26/2011 6:06 PM, KK wrote:
> Hi Jason,
> This does not work in my case...since I need to aggregate all amounts
> for week ending Sunday(including sunday)...every sunday. I just need to
> show the aggregated value and dont need to show the detail amounts for
> the rest of the week.
> I tried your calculated column but when I grouped by it...it groups by
> all Sundays...and week number starts a new week on Sunday so misses out
> on Sunday values. please advise.
Re: Get the Sundays ( dates) from a date range [message #730925 is a reply to message #730077] Thu, 29 September 2011 14:44 Go to previous message
KK  is currently offline KK Friend
Messages: 24
Registered: July 2011
Junior Member
Great idea, Jason. I will try this out.
Just so you know,alternatively, I did the grouping in mysql....for the longest time I was wondering why I was getting the wrong total...it was short of that Sunday's numbers. Then I realized that the Week() function ends on Sunday by default, but there is an option to start on Monday....Week(<date>,1). This helped me.

Appreciate all your help....as always.
Previous Topic:PHP and JavaBridge - run report and show print and export buttons
Next Topic:Re: Dynamic Parameter with Scripted Data Set
Goto Forum:
  


Current Time: Fri Apr 19 21:45:46 GMT 2024

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

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

Back to the top