Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Archived » BIRT » Read Value of a NamedExpressionValue(How can i read a vlaue of namedExpression Value at PresentationTime)
Read Value of a NamedExpressionValue [message #1679389] Mon, 16 March 2015 15:47 Go to next message
Hans-Georg Glöckler is currently offline Hans-Georg GlöcklerFriend
Messages: 88
Registered: July 2009
Member
I use eclipse 4.4.1, windows 8.1, java 7, birt 4.4.1 and the Example Database of BIRT. I want to make all in java.

I have a report with a table with 6 columns
Columns 1-5 with Databinding
Column 6 with the following Expression:
BirtMath.multiply(dataSetRow["QUANTITYORDERED"],dataSetRow["PRICEEACH"])
with DataType float and name "TOTAL_ROW"


In the table footer I added a Data with following Expression
Total.sum(row["TOTAL_ROW"])
with DataType float and name "TOTAL"

In the Row i added the following RowEventHandle
	@Override
	public void onCreate(IRowInstance arg0, IReportContext arg1)
			throws ScriptException {
		try {
			Double price = (Double) arg0.getRowData().getExpressionValue(
					"row[TOTAL_ROW]");
			Double totalPrice1 = (Double) arg0.getRowData().getExpressionValue(
					"row[TOTAL]");
			Double totalPrice2 = (Double) arg0.getParent()
					.getNamedExpressionValue("TOTAL");
			
			if (price.doubleValue() > totalPrice1.doubleValue() / 50)
				arg0.getStyle().setBackgroundColor("red");
		} catch (ScriptException e) {
			e.printStackTrace();
		}
	}



For the variables price and totalPrice1 I get the correct values.
But for the variable totalPrice2 I get always null

Attached I send the Report-File
Re: Read Value of a NamedExpressionValue [message #1682430 is a reply to message #1679389] Tue, 17 March 2015 18:37 Go to previous message
Michael Williams is currently offline Michael WilliamsFriend
Messages: 1925
Registered: July 2009
Senior Member

What is the named expression value? I don't see any named expressions set in your sample design attached.

Michael

Developer Evangelist, Silanis
Previous Topic:Custom XML based data source
Next Topic:Dynamic number of bar charts needs to be placed one after another
Goto Forum:
  


Current Time: Sat Jul 13 17:10:03 GMT 2024

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

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

Back to the top