Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » BIRT » Read report design (Is there a way to read a report design from a database table?)
Read report design [message #549733] Tue, 27 July 2010 18:33 Go to next message
Kris Chappell is currently offline Kris ChappellFriend
Messages: 6
Registered: July 2009
Junior Member
I need to store my report designs in a database table rather than storing them in a folder on the server, is there a way to store these in the database and read the design from that table and send the design to the run and render task when a report request is made? I could store these in a column either as xml or as a file. Has anybody done this? I'm having problems implementing this.

Thank you,
Re: Read report design [message #550050 is a reply to message #549733] Wed, 28 July 2010 21:38 Go to previous messageGo to next message
Scott Rosenbaum is currently offline Scott RosenbaumFriend
Messages: 425
Registered: July 2009
Senior Member
Kris,

Haven't done this specificallly, but I know of quite a few people that have.
The .rptdesign is just a text file, so if you store as text and then pull
it out and feed that into your ReportEngine it should work.

What specific problems are you running into?

Scott Rosenbaum
Innovent Solutions, BIRT PMC


> I need to store my report designs in a database table rather than
> storing them in a folder on the server, is there a way to store these
> in the database and read the design from that table and send the
> design to the run and render task when a report request is made? I
> could store these in a column either as xml or as a file. Has anybody
> done this? I'm having problems implementing this.
>
> Thank you,
>
Re: Read report design [message #550175 is a reply to message #550050] Thu, 29 July 2010 13:03 Go to previous messageGo to next message
Kris Chappell is currently offline Kris ChappellFriend
Messages: 6
Registered: July 2009
Junior Member
Hi Scott,

Thank you so much for replying to my question.

I have tried pulling the information from the database into a String and then just passing the string to the openReportDesign method. I have also tried passing it in using a ByteArrayInputStream getBytes method. Both result in an invalid xml parsing error. I have validated the xml and it is well formed.

I fixed the above problem, but now I am getting
j
avax.servlet.ServletException: org.eclipse.birt.report.engine.api.EngineException: The design file can not be found.

I'm pretty new to java, so it takes me quite a while to whittle away at these issues.

String lReportDesign = RptDbUtil.retrieveDesign("inactiveUsers", "1");
lDesign = aBirtEngine.openReportDesign(lReportDesign);

//create task to run and render report
IRunAndRenderTask lTask = aBirtEngine.createRunAndRenderTask( lDesign );

Thanks again for your reply.

Re: Read report design [message #550195 is a reply to message #550175] Thu, 29 July 2010 13:54 Go to previous messageGo to next message
Kris Chappell is currently offline Kris ChappellFriend
Messages: 6
Registered: July 2009
Junior Member
Whoo hooo!!!! I got it to work. Thanks again Scott for your reply.
Re: Read report design [message #550221 is a reply to message #550195] Thu, 29 July 2010 14:44 Go to previous messageGo to next message
Jason Weathersby is currently offline Jason WeathersbyFriend
Messages: 9167
Registered: July 2009
Senior Member

Kris,

Can you post what you did to help others?

Jason

On 7/29/2010 9:54 AM, Kris Chappell wrote:
> Whoo hooo!!!! I got it to work. Thanks again Scott for your reply.
Re: Read report design [message #550236 is a reply to message #550221] Thu, 29 July 2010 15:08 Go to previous messageGo to next message
Kris Chappell is currently offline Kris ChappellFriend
Messages: 6
Registered: July 2009
Junior Member
Well, I'm not really the best person to ask, I'm not a java programmer. But the problem that I had was in my return from fetching the design. This is the working method.

public class RptDbUtil
implements RptDbSql
{
public static String
retrieveDesign(String pReportName, String pVersion)
throws Exception
{
Log.debug("Entered RptDbUtil.retrieveDesign");
CHGSQLService lService = CHGSQLService.getInstance();
SQLResult lResult = lService.executeQuery(RptDbSql.SQL_SELECT_DESIGN, new Object [] {pReportName, pVersion}, 0L);
if (lResult.getRowCount() == 0)
{
throw new RuntimeException("Report not found " + pReportName + " for version " + pVersion);

}
return lResult.getRow(0).getValue(0).toString();

}
}


I was returning lResult.getRow(0).toString(); which was returning an object instead of a string. The string is passed into the openReportDesign using this:

lDesign = aBirtEngine.openReportDesign(new ByteArrayInputStream(RptDbUtil.retrieveDesign("inactiveUsers ", "1").getBytes()));

There may be a more efficient or more elegant way, but this worked for me. Smile


Re: Read report design [message #550241 is a reply to message #550236] Thu, 29 July 2010 15:11 Go to previous message
Jason Weathersby is currently offline Jason WeathersbyFriend
Messages: 9167
Registered: July 2009
Senior Member

Thanks for posting!

On 7/29/2010 11:08 AM, Kris Chappell wrote:
> Well, I'm not really the best person to ask, I'm not a java programmer.
> But the problem that I had was in my return from fetching the design.
> This is the working method.
>
> public class RptDbUtil implements RptDbSql
> {
> public static String
> retrieveDesign(String pReportName, String pVersion)
> throws Exception
> {
> Log.debug("Entered RptDbUtil.retrieveDesign");
> CHGSQLService lService = CHGSQLService.getInstance();
> SQLResult lResult = lService.executeQuery(RptDbSql.SQL_SELECT_DESIGN,
> new Object [] {pReportName, pVersion}, 0L); if (lResult.getRowCount() == 0)
> {
> throw new RuntimeException("Report not found " + pReportName + " for
> version " + pVersion);
>
> }
> return lResult.getRow(0).getValue(0).toString();
>
> }
> }
>
>
> I was returning lResult.getRow(0).toString(); which was returning an
> object instead of a string. The string is passed into the
> openReportDesign using this:
>
> lDesign = aBirtEngine.openReportDesign(new
> ByteArrayInputStream(RptDbUtil.retrieveDesign("inactiveUsers ",
> "1").getBytes()));
>
> There may be a more efficient or more elegant way, but this worked for
> me. :)
>
>
>
Previous Topic:Missing TOC for Word
Next Topic:CSS Highlight property
Goto Forum:
  


Current Time: Fri Nov 28 01:56:27 GMT 2014

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

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