Thanks for the idea PRASSANA, here is what i did.
// I declared 3 variables
str orgUnit;
date sDate;
date eDate;
;
while select History
{
if (History.orgUnit == orgUnit && (eDate +1) >= History.sDate)
{
tmpTable.orgUnit = orgUnit;
tmpTable.sDate = sDate;
tmpTable.eDate = History.eDate;
tmpTable.insert();
eDate = History.eDate;
}
else
{
this.send(tmpTable);
tmpTable.orgUnit = History.orgUnit;
tmpTable.sDate = History.sDate;
tmpTable.eDate = History.eDate
tmpTable.insert();
orgUnit = History.orgUnit;
sDate = History.sDate;
eDate = History.eDate;
}
}
It worked fine and give me the result i needed. please comment on
this. advice for its improvemtn would be very much appreciated.
thanks.
uriskh.
--- In [email protected], "prasanna_koulgi"
<[EMAIL PROTECTED]> wrote:
>
> Hi there,
>
>
> I think no need to have a temporary table.........
>
> Just take a look on this logic.........
>
>
>
> Take a temp variable say
> Prt end date = previous rec. end date // temp variable date
> While select data
> If prt end date + 1 == this rec. start date
> Prt end date == this rec. enddate
> Else
> {
> Print your data
.
> (here print end date stored in variable
. )
> }
> It is just a hint ..
>
> You have to update t temp variable as required.........
>
>
> PRASANNA
>
>
>
>
> <gunjanbhattacharyya@> wrote:
> >
> > Hi
> >
> > I think you should create a temporary table to collect all the
data
> > from the main table and write the logic there in a method (which
> > should be called from the fetch method in the report). The code
u
> > write should just create one line for all The "NOR" values. Then
send
> > the temporary table in the normal way as this.send(tempTable).
> > Assuming tempTable is the buffer for the temporary table. This
should
> > work.. as i had done the same for another report. Please try the
same
> > and let me know if it works..
> >
> > Thanks
> >
> > Gunjan
> >
> >
> > --- In [email protected], "uriskh" <uriskh@>
> > wrote:
> > >
> > > Hi, I got this history record from HR where i want to merge
some
> > > record to print in the report. please give an idea how to do
this
> > > task. thanks.
> > >
> > > record from history:
> > >
> > > Org Unit Start date End date
> > >
> > > BAR 8/14/2005 8/20/2005
> > > CAP 6/21/2003 7/5/2003
> > > MAS 7/6/2003 7/20/2003
> > > NOR 8/11/2003 8/20/2003
> > > NOR 8/21/2003 9/4/2003
> > > NOR 9/5/2003 9/19/2003
> > > NOR 9/20/2003 10/5/2003
> > > NOR 10/6/2003 10/20/2003
> > > NOR 11/6/2003 11/20/2003
> > >
> > > this is what i want to show in the report.
> > >
> > > Org Unit start date end date
> > >
> > > BAR 8/14/2005 8/20/2005
> > > CAP 6/21/2003 7/5/2003
> > > MAS 7/6/2003 7/20/2003
> > > NOR 8/11/2003 10/20/2003
> > > NOR 11/6/2003 11/20/2003
> > >
> > > i want to merge the record if the org unit is the same and the
> > start
> > > date of the second record is next to the end date of the
previous
> > > record, but if it has at least a day of gap it will become a
new
> > > line in the report. thanks you for your help..
> > >
> >
>