Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Archived » BIRT » Compare value in detail row
icon4.gif  Compare value in detail row [message #692828] Tue, 05 July 2011 10:12 Go to next message
siebrenfeenstra is currently offline siebrenfeenstraFriend
Messages: 2
Registered: July 2011
Junior Member
In my report I have a table with a detail row with the value
dataSetRow["step"]

I want to number my rows with the following rule:
row.__rownum*10+400 (400, 410, 420, ...)

But if the value of dataSetRow["step"] is the same as the row before, the row number has also have the same number.

Can I create such like:
if (dataSetRow["stap"] == previous.dataSetRow["stap"])
{
rownum = previous.rownum
}

I hope i've descriped my problem clear on this way.
Re: Compare value in detail row [message #692991 is a reply to message #692828] Tue, 05 July 2011 15:14 Go to previous messageGo to next message
Jason Weathersby is currently offline Jason WeathersbyFriend
Messages: 9167
Registered: July 2009
Senior Member

There is a previous row aggregate function extension example on birt
exchange that could be used to show you how to implement your own
aggregate function.
http://www.birt-exchange.org/org/devshare/designing-birt-reports/1103-aggregate-function-to-subtract-previous-row-value/

Or you could do it all in a data item expression like:

importPackage(Packages.java.lang);
var rwc = 0;
if( reportContext.getGlobalVariable("last") == null ){
rwc = row.__rownum*10+400
reportContext.setGlobalVariable("last", new
Integer(dataSetRow["ORDERNUMBER"]));
reportContext.setGlobalVariable("lastrwc", new Integer(rwc));
}else{
if( parseInt(reportContext.getGlobalVariable("last")) ==
dataSetRow["ORDERNUMBER"] ){
rwc = reportContext.getGlobalVariable("lastrwc");
}else{
rwc = row.__rownum*10+400
}
reportContext.setGlobalVariable("last", new
Integer(dataSetRow["ORDERNUMBER"]));
reportContext.setGlobalVariable("lastrwc", new Integer(rwc));
}
rwc;

See attached example.

Jason

On 7/5/2011 6:12 AM, forums-noreply@eclipse.org wrote:
> In my report I have a table with a detail row with the value
> dataSetRow["step"]
>
> I want to number my rows with the following rule:
> row.__rownum*10+400 (400, 410, 420, ...)
>
> But if the value of dataSetRow["step"] is the same as the row before,
> the row number has also have the same number.
>
> Can I create such like:
> if (dataSetRow["stap"] == previous.dataSetRow["stap"])
> {
> rownum = previous.rownum
> }
>
> I hope i've descriped my problem clear on this way.
>
Re: Compare value in detail row [message #693339 is a reply to message #692991] Wed, 06 July 2011 09:39 Go to previous message
siebrenfeenstra is currently offline siebrenfeenstraFriend
Messages: 2
Registered: July 2011
Junior Member
Thank you!
This is the solution, it works.
Smile
Previous Topic:(no subject)
Next Topic:java.lang.NullPointerException after shutdown platform
Goto Forum:
  


Current Time: Sat Mar 30 06:29:16 GMT 2024

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

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

Back to the top