Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » BIRT » Create elements that derive from rptlibrary using Designer API(LabelHandle label = elementFactory.newLabel( null ); )
Create elements that derive from rptlibrary using Designer API [message #990692] Thu, 13 December 2012 20:07 Go to next message
Aleksey   is currently offline Aleksey Friend
Messages: 42
Registered: April 2012
Member
Hello,
We are testing BIRT Designer API to create some reports on the fly at runtime. So far it works but we seems can't find a way how to create an item in a report that derives from an item defined in rptlibrary. For example, I can add a label to a grid dynamically:
GridHandle grid = elementFactory.newGridItem("QR_VertGrid", 2, 5);
CellHandle g_cell = grid.getCell(0, 0);
LabelHandle label = elementFactory.newLabel(null);
label.setText("Test Label");
g_cell.getContent().add(label);

but I can't find a method that would allow me to create a label that would be a subclass of the one that is defined in my rptlibrary. Is that possible?

Thanks,
Aleksey
Re: Create elements that derive from rptlibrary using Designer API [message #990919 is a reply to message #990692] Fri, 14 December 2012 21:37 Go to previous messageGo to next message
Aleksey   is currently offline Aleksey Friend
Messages: 42
Registered: April 2012
Member
looks like you can use elementFactory.newElementFrom(libHandle.findElement("CP_LabelCntl"), null);

where libHandle is LibraryHandle to your library. It works for labels.

However, I cannot make it work for DataItemHandle. The element seems to be created but when I run a report I am getting an error saying "data expression required". I tried this code:
ComputedColumn binding = StructureFactory.createComputedColumn();
binding.setName("MyBinding_COLUMN1");
binding.setExpression("dataSetRow[\"COLUMN1\"]");
binding.setDataType(DesignChoiceConstants.COLUMN_DATA_TYPE_DECIMAL);
table.getColumnBindings().addItem(binding);
DataItemHandle data = (DataItemHandle) elementFactory.newElementFrom(libHandle.findElement("CP_DecimalCntl"), binding.getName());
data.setResultSetColumn(binding.getName());
cell.getContent().add(data);

Michael, Jason,
Would you please take a look? The question is how to create a data item element that derives from the library using Designer API and then how to assign a dataset column to this item? This is BIRT 3.7.1. Thanks!
Re: Create elements that derive from rptlibrary using Designer API [message #991405 is a reply to message #990919] Tue, 18 December 2012 22:33 Go to previous message
Michael Williams is currently offline Michael WilliamsFriend
Messages: 1663
Registered: July 2009
Senior Member

Sorry for the delay. You're trying to add a binding to a table using the DEAPI and then also create a data element within based on a data element from your library? Is the field used, in the dataSet you use for the table? Can you possibly attach a sample library and report and describe what you're wanting to see, based on those, so I can get a good visual? Thanks!

Michael

Add interactivity, scheduling, sharing, live Excel export, and JS integration to your BIRT app with the new, free BIRT server, BIRT iHub F-Type.
Previous Topic:Height of Report Viewer embedded in iframe
Next Topic:Connection Pool in Birt Viewer
Goto Forum:
  


Current Time: Sun Nov 23 14:57:42 GMT 2014

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

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