Discussions
Categories
Groups
Community Home
Categories
INTERNAL ENABLEMENT
POPULAR
THRUST SERVICES & TOOLS
CLOUD EDITIONS
Quick Links
MY LINKS
HELPFUL TIPS
Back to website
Home
Intelligence (Analytics)
Cross Tab Report
Ramachandr
Hi,
I have created a simple cross tab report using the follwing code. I am unable to add the row and columns on it. Can anyone provide the information how to add them. Here is the complete code:
import java.io.IOException;
import org.eclipse.birt.core.framework.Platform;
import org.eclipse.birt.report.model.api.DesignConfig;
import org.eclipse.birt.report.model.api.DesignElementHandle;
import org.eclipse.birt.report.model.api.ElementFactory;
import org.eclipse.birt.report.model.api.ExtendedItemHandle;
import org.eclipse.birt.report.model.api.IDesignEngine;
import org.eclipse.birt.report.model.api.IDesignEngineFactory;
import org.eclipse.birt.report.model.api.ReportDesignHandle;
import org.eclipse.birt.report.model.api.SessionHandle;
import org.eclipse.birt.report.model.api.activity.SemanticException;
import com.ibm.icu.util.ULocale;
public class test
{
ReportDesignHandle designHandle = null;
ElementFactory designFactory = null;
public static void main( String[] args ) throws Exception
{
try
{
buildReport();
}
catch ( IOException e )
{
e.printStackTrace();
}
catch ( SemanticException e )
{
e.printStackTrace();
}
}
static void buildReport() throws IOException, SemanticException
{
try{
DesignConfig config = new DesignConfig( );
config.setProperty("BIRT_HOME", "C:/Birt/birt-runtime-2_3_0/ReportEngine");
IDesignEngine engine = null;
try{
Platform.startup( config );
IDesignEngineFactory factory = (IDesignEngineFactory) Platform
.createFactoryObject( IDesignEngineFactory.EXTENSION_DESIGN_ENGINE_FACTORY );
engine = factory.createDesignEngine( config );
}catch( Exception ex){
ex.printStackTrace();
}
SessionHandle session = engine.newSessionHandle( ULocale.ENGLISH ) ;
ReportDesignHandle design = session.createDesign( );
ElementFactory factory = design.getElementFactory( );
DesignElementHandle element = factory.newSimpleMasterPage( "Page Master" ); //$NON-NLS-1$
design.getMasterPages( ).add( element );
ExtendedItemHandle crosstabItem= factory.newExtendedItem("Crosstab","Crosstab");
design.getBody().add(crosstabItem);
design.saveAs( "c:/BirtReport/test.rptdesign" );
design.close( );
System.out.println("Finished");
}catch (Exception e){
e.printStackTrace();
}
}
}
Find more posts tagged with
Comments
zqian
You may get a CrosstabReportItemHandle instance by :
CrosstabReportItemHandle crosstabHandle = (CrosstabReportItemHandle )crosstabItem.getReportItem();
and look at the various methods in CrosstabReportItemHandle, it serves as a convenient Crosstab API wrapper over ExtendedItemHandle interface.
gbutler69
Where can one find the JavaDoc/API Reference for "CrossTabHandle"?
I'd like to use it from the "onPrepare" event of the cross-tab in the design and/or the "beforeFactory" event of the report design. Is that feasible?