Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » BIRT » Compare value in detail row
icon4.gif  Compare value in detail row [message #692828] Tue, 05 July 2011 06:12 Go to next message
siebrenfeenstra is currently offline siebrenfeenstra
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 11:14 Go to previous messageGo to next message
Jason Weathersby is currently offline Jason Weathersby
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 05:39 Go to previous message
siebrenfeenstra is currently offline siebrenfeenstra
Messages: 2
Registered: July 2011
Junior Member
Thank you!
This is the solution, it works.
Smile
Previous Topic:Internal bookmark (label to label)
Next Topic:java.lang.NullPointerException after shutdown platform
Goto Forum:
  


Current Time: Wed Jul 23 12:16:55 EDT 2014

Powered by FUDForum. Page generated in 0.03184 seconds