Discussions
Categories
Groups
Community Home
Categories
INTERNAL ENABLEMENT
POPULAR
PUBLIC CLOUD
PRIVATE CLOUD
Quick Links
MY LINKS
HELPFUL TIPS
Back to website
Home
Intelligence (Analytics)
How do I add library dataset to report design programatically using DEAPI?
qos
Hello,
I am new with DEAPI and I can't find out how to add programatically a library data source/data set to a report design using the API.
Using the API I created the rptlibrary, added datasource and dataset and created the report design. My goal is to have the report design with the reference to data source and data set in library (like the library datasource 'Add to Report' action in resource explorer view).
For now I have this code:
template = BirtSession.getInstance().createDesign(filename);
LibraryHandle lh = library.getLibrary();
OdaDataSourceHandle odsh = (OdaDataSourceHandle)lh.getDataSources().get(0);
template.getDataSources().add(odsh);
for (Iterator<OdaDataSetHandle> i = lh.getDataSets().iterator(); i.hasNext(); )
{
template.getDataSets().add(i.next());
}
template.save();
But I am getting this exception:
org.eclipse.birt.report.model.api.command.ContentException: Element "ODA Data Source("xx_DataSource")" is not allowed to be added into the (dataSources) of "report", for it is already in the design tree.
at org.eclipse.birt.report.model.util.ContentExceptionFactory.createContentException(ContentExceptionFactory.java:43)
at org.eclipse.birt.report.model.command.AbstractContentCommand.add(AbstractContentCommand.java:120)
at org.eclipse.birt.report.model.command.AbstractContentCommand.add(AbstractContentCommand.java:255)
at org.eclipse.birt.report.model.api.SlotHandle.add(SlotHandle.java:126)
at org.eclipse.birt.report.model.api.SlotHandle.add(SlotHandle.java:80)
Hope you can help me, thanks in advance
Find more posts tagged with
Comments
qos
Found a good topic about this problem, it is solved.
http://www.birt-exchange.org/org/forum/index.php/topic/16109-how-is-a-library-supposed-to-work-anyway/page__hl__LibraryHandle__fromsearch__1
Thank you