Skip to main content



      Home
Home » Archived » BIRT » beforeFactory, findElement("XXX").drop()
beforeFactory, findElement("XXX").drop() [message #689683] Tue, 28 June 2011 03:26 Go to next message
Eclipse UserFriend
I find that in event beforeFactory, there is some code like
if(params["OSType"].value != "linux")
{
  if( reportContext.getReportRunnable().designHandle.getDesignHandle().findElement("Linux Section") != null)
	 reportContext.getReportRunnable().designHandle.getDesignHandle().findElement("Linux Section").drop();
	
}
if(params["OSType"].value != "windows")
{
	if( reportContext.getReportRunnable().designHandle.getDesignHandle().findElement("Windows Section") != null)
	 reportContext.getReportRunnable().designHandle.getDesignHandle().findElement("Windows Section").drop();
	
}
if(params["OSType"].value != "unix")
{
	if( reportContext.getReportRunnable().designHandle.getDesignHandle().findElement("Unix Section") != null)
	 reportContext.getReportRunnable().designHandle.getDesignHandle().findElement("Unix Section").drop();
	
}

the problem is if the user select paramter "windows" first, then close the report, then rerun the report and select parameter other than "windows", no output because the other OS section is drop!!
1) Is there any method to re-add the section after it is dropped in first run of beforeFactory?
2) Also, is beforeFactory run everytime the report is run?
3) I tried to change the visibility property of the section instead of drop element, but I found that even I invisible that section, the table inside the section, and so the related dataset, sql statement is still run!!
Re: beforeFactory, findElement("XXX").drop() [message #689927 is a reply to message #689683] Tue, 28 June 2011 11:30 Go to previous message
Eclipse UserFriend
The beforeFactory runs every time you run the report. This code should
work. What version of BIRT are you using and can you post the report?
If you are using 2.3.2 or later use:

reportContext.getDesignHandle().findElement("LinuxSection").drop();

You may also want to drop in something like the following for testing:

importPackage( Packages.java.io );
out = new PrintWriter( new FileWriter( "c:/test/beforeevents.txt", true ) );
out.println( "beforeFactory " + params["OSType"].value);
out.close();

and see what is printed in the beforeevents.txt file.

Jason

On 6/28/2011 3:26 AM, forums-noreply@eclipse.org wrote:
> I find that in event beforeFactory, there is some code like
>
> if(params["OSType"].value != "linux")
> {
> if(
> reportContext.getReportRunnable().designHandle.getDesignHandle().findElement("Linux
> Section") != null)
> reportContext.getReportRunnable().designHandle.getDesignHandle().findElement("Linux
> Section").drop();
>
> }
> if(params["OSType"].value != "windows")
> {
> if(
> reportContext.getReportRunnable().designHandle.getDesignHandle().findElement("Windows
> Section") != null)
> reportContext.getReportRunnable().designHandle.getDesignHandle().findElement("Windows
> Section").drop();
>
> }
> if(params["OSType"].value != "unix")
> {
> if(
> reportContext.getReportRunnable().designHandle.getDesignHandle().findElement("Unix
> Section") != null)
> reportContext.getReportRunnable().designHandle.getDesignHandle().findElement("Unix
> Section").drop();
>
> }
>
> the problem is if the user select paramter "windows" first, then close
> the report, then rerun the report and select parameter other than
> "windows", no output because the other OS section is drop!!
> 1) Is there any method to re-add the section after it is dropped in
> first run of beforeFactory?
> 2) Also, is beforeFactory run everytime the report is run?
> 3) I tried to change the visibility property of the section instead of
> drop element, but I found that even I invisible that section, the table
> inside the section, and so the related dataset, sql statement is still
> run!!
>
Previous Topic:word in column cannot wrap
Next Topic:Birthday -> Age + Query on CSV data
Goto Forum:
  


Current Time: Fri Jul 04 18:38:42 EDT 2025

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

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

Back to the top