Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » BIRT » Problem on set global variable(Problem passing varibles form onFetch and beforeDrawMarkerLine)
Problem on set global variable [message #1009160] Thu, 14 February 2013 10:13 Go to next message
Mimmo Rossi is currently offline Mimmo Rossi
Messages: 108
Registered: February 2013
Senior Member
Hi all,
i have this problem: on onFetch of one Data Set i insert one global varible like this:
reportContext.setPersistentGlobalVariable("MARKER_MIN","2");


in a chart i try to use this varible in this way:
function beforeDrawMarkerLine(axis, markerLine, icsc){
   importPackage(Packages.org.eclipse.birt.chart.model.data.impl);
   importPackage(Packages.org.eclipse.birt.chart.model.component.impl);
   var val=icsc.getExternalContext().getScriptable().getPersistentGlobalVariable("MARKER_MIN");
   markerLine.setValue(NumberDataElementImpl.create(val)) ;
}

but i received this error:
Can't find method org.eclipse.birt.chart.model.data.impl.NumberDataElementImpl.create(null).
I used also SetGlobalVariable and getGlobalVariable but i received the same error
what is wrong?
Re: Problem on set global variable [message #1009218 is a reply to message #1009160] Thu, 14 February 2013 12:33 Go to previous messageGo to next message
Jason Weathersby is currently offline Jason Weathersby
Messages: 9167
Registered: July 2009
Senior Member

If you put this:
reportContext.setPersistentGlobalVariable("MARKER_MIN","2")

In the beforeFactory, do you have the same issue?

Jason
BIRT-Exchange


Jason Weathersby

BIRT Exchange
Re: Problem on set global variable [message #1009588 is a reply to message #1009218] Fri, 15 February 2013 05:55 Go to previous messageGo to next message
Mimmo Rossi is currently offline Mimmo Rossi
Messages: 108
Registered: February 2013
Senior Member
Hi,
now is ok, but i bind the query in a table in my header and now in the chart i get the correct data...it seems that the query is not fetched when i create my chart(in which i bind another query).
So, i have some dubt:
1) birt when execute the query, at binding to an object or at opening of report?
2) if i have 2 query,in what order are executed?
Thanks anyway for your time and for the speed of response
Re: Problem on set global variable [message #1011035 is a reply to message #1009588] Mon, 18 February 2013 12:47 Go to previous messageGo to next message
Jason Weathersby is currently offline Jason Weathersby
Messages: 9167
Registered: July 2009
Senior Member

Queries are executed when the report runs and only if they are bound to an item that is getting created. If you have two queries, they execute before the creation of the items that uses the respective queries created, but other than that you can not guarantee the order because it can be changed on things like aggregation. Generally if you want to hook something like onFetch it is often better to just hook the onCreate of the table row that uses it.

Jason


Jason Weathersby

BIRT Exchange
Re: Problem on set global variable [message #1011825 is a reply to message #1011035] Wed, 20 February 2013 05:17 Go to previous messageGo to next message
Mimmo Rossi is currently offline Mimmo Rossi
Messages: 108
Registered: February 2013
Senior Member
Hi Jason,
i have another question about run query, if i have 1 query and 2 tables and if i bind the query in both tables, how many times the query is executed?
Thanks
Re: Problem on set global variable [message #1012131 is a reply to message #1011825] Wed, 20 February 2013 18:47 Go to previous message
Jason Weathersby is currently offline Jason Weathersby
Messages: 9167
Registered: July 2009
Senior Member

Great question. By default the query will only execute once. If you are using BIRT 4.2 or later you can change this behavior.
See:
http://www.eclipse.org/birt/phoenix/project/notable4.2.php#jump_11

Jason


Jason Weathersby

BIRT Exchange
Previous Topic:Executable jar with maven shade plugin
Next Topic:Tool tip was displayed twice in firefox
Goto Forum:
  


Current Time: Sun May 26 04:55:32 EDT 2013

Powered by FUDForum. Page generated in 0.01710 seconds