Skip to main content



      Home
Home » Archived » BIRT » Problems understanding monthly groupings
Problems understanding monthly groupings [message #88440] Mon, 07 November 2005 13:29 Go to next message
Eclipse UserFriend
Originally posted by: pcasey.earthlink.net

I have a dataset that returns data in the form:

Date Cost
01/01/05 $100
01/02/05 $25
02/01/05 $50

I want to print a report that says:

SPAN : 01/01/05-01/31/05
01/01/05 $100
01/02/05 $25
Total: $125

SPAN : 02/01/05-02/30/05
02/01/05 $50
Total: $50

So what I did was group my dataset on the date column with an Interval
of "Month" and a range of 1. Sure enough, the data comes back propely
grouped and all is (mostly) well. The details part is no problem. The total
is no problem. The group header is stumping me.

What I can't figure out though is how to print out the group header
properly. If I'm currently rendering the group for January, what do I put in
my data element to show, well, "January" or just the start and end dates for
the group?

Basically, I'm looking for the syntax to create the SPAN: groupStart -
groupEnd line.

Thanks,

--- Pat
Re: Problems understanding monthly groupings [message #88470 is a reply to message #88440] Mon, 07 November 2005 14:00 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: pcasey.earthlink.net

In case anyone else runs into this, this script works, but there is
probably a better way;

month = row["incurred"].getMonth();

// getyear is buggy and returns year offset from

// 1900 instead of year zero as per spec

currentYear = row["incurred"].getYear() + 1900;

switch(month) {

case 0:

currentMonth="January";

break;

case 1:

currentMonth="February";

break;

case 2:

currentMonth="March";

break;

case 3:

currentMonth="April";

break;

case 4:

currentMonth="May";

break;

case 5:

currentMonth="June";

break;

case 6:

currentMonth="July";

break;

case 7:

currentMonth="August";

break;

case 8:

currentMonth="September";

break;

case 9:

currentMonth="October";

break;

case 10:

currentMonth="November";

break;

case 11:

currentMonth="December";

break;

}

currentMonth + ", " + currentYear



"Patrick Casey" <pcasey@earthlink.net> wrote in message
news:dko6et$nv4$1@news.eclipse.org...
>
> I have a dataset that returns data in the form:
>
> Date Cost
> 01/01/05 $100
> 01/02/05 $25
> 02/01/05 $50
>
> I want to print a report that says:
>
> SPAN : 01/01/05-01/31/05
> 01/01/05 $100
> 01/02/05 $25
> Total: $125
>
> SPAN : 02/01/05-02/30/05
> 02/01/05 $50
> Total: $50
>
> So what I did was group my dataset on the date column with an Interval
> of "Month" and a range of 1. Sure enough, the data comes back propely
> grouped and all is (mostly) well. The details part is no problem. The
> total is no problem. The group header is stumping me.
>
> What I can't figure out though is how to print out the group header
> properly. If I'm currently rendering the group for January, what do I put
> in my data element to show, well, "January" or just the start and end
> dates for the group?
>
> Basically, I'm looking for the syntax to create the SPAN: groupStart -
> groupEnd line.
>
> Thanks,
>
> --- Pat
>
Re: Problems understanding monthly groupings [message #88849 is a reply to message #88470] Tue, 08 November 2005 14:10 Go to previous message
Eclipse UserFriend
Here's a simpler way.

(1) Insert a text element in the group header.
(2) Select HTML/Dynamic text.
(3) Type the following in the text area:
<VALUE-OF format="MMMM">row["dateColumn"]</VALUE-OF>

The "MMMM" format returns the month of a date by its name, e.g., January.

"Patrick Casey" <pcasey@earthlink.net> wrote in message
news:dko88m$qmf$1@news.eclipse.org...
>
> In case anyone else runs into this, this script works, but there is
> probably a better way;
>
> month = row["incurred"].getMonth();
>
> // getyear is buggy and returns year offset from
>
> // 1900 instead of year zero as per spec
>
> currentYear = row["incurred"].getYear() + 1900;
>
> switch(month) {
>
> case 0:
>
> currentMonth="January";
>
> break;
>
> case 1:
>
> currentMonth="February";
>
> break;
>
> case 2:
>
> currentMonth="March";
>
> break;
>
> case 3:
>
> currentMonth="April";
>
> break;
>
> case 4:
>
> currentMonth="May";
>
> break;
>
> case 5:
>
> currentMonth="June";
>
> break;
>
> case 6:
>
> currentMonth="July";
>
> break;
>
> case 7:
>
> currentMonth="August";
>
> break;
>
> case 8:
>
> currentMonth="September";
>
> break;
>
> case 9:
>
> currentMonth="October";
>
> break;
>
> case 10:
>
> currentMonth="November";
>
> break;
>
> case 11:
>
> currentMonth="December";
>
> break;
>
> }
>
> currentMonth + ", " + currentYear
>
>
>
> "Patrick Casey" <pcasey@earthlink.net> wrote in message
> news:dko6et$nv4$1@news.eclipse.org...
> >
> > I have a dataset that returns data in the form:
> >
> > Date Cost
> > 01/01/05 $100
> > 01/02/05 $25
> > 02/01/05 $50
> >
> > I want to print a report that says:
> >
> > SPAN : 01/01/05-01/31/05
> > 01/01/05 $100
> > 01/02/05 $25
> > Total: $125
> >
> > SPAN : 02/01/05-02/30/05
> > 02/01/05 $50
> > Total: $50
> >
> > So what I did was group my dataset on the date column with an
Interval
> > of "Month" and a range of 1. Sure enough, the data comes back propely
> > grouped and all is (mostly) well. The details part is no problem. The
> > total is no problem. The group header is stumping me.
> >
> > What I can't figure out though is how to print out the group header
> > properly. If I'm currently rendering the group for January, what do I
put
> > in my data element to show, well, "January" or just the start and end
> > dates for the group?
> >
> > Basically, I'm looking for the syntax to create the SPAN:
groupStart -
> > groupEnd line.
> >
> > Thanks,
> >
> > --- Pat
> >
>
>
Previous Topic:Problems with getYear() on Date Values
Next Topic:Problem with Binding Report Parameters to DateSet Parameters
Goto Forum:
  


Current Time: Wed May 07 19:16:32 EDT 2025

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

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

Back to the top