Skip to main content



      Home
Home » Archived » BIRT » Can the Report Viewer work with Scripted DataSets ?
Can the Report Viewer work with Scripted DataSets ? [message #263864] Wed, 02 January 2008 09:46 Go to next message
Eclipse UserFriend
Originally posted by: assaf.frank.dynasec.org

Hi,

I'm looking to generate my reports while using my application java APIs
(using DB datasource directly is too complex).
SO is my only way is to use the scripted data set ?
Can this work with the erport viewer ? Can I pass params within a request
objet to the viewer ?

I would like to continue to work with the viewer becuase of its extensive
paging and export capabilities (basiclly to excel..)

What are my other options to continue to work with the viewer but generate
the data from my own java classes? (If I prodocue text files and use file
datasource how can users generate reports at the same time ??)

Thanks very much.
Re: Can the Report Viewer work with Scripted DataSets ? [message #263950 is a reply to message #263864] Fri, 04 January 2008 11:54 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: jasonweathersby.alltel.net

Assaf,

A scripted data source written in Java or JavaScript is probably your
best option and it will work with the viewer. Just make sure to put the
jars containing your classes in the web-inf/lib or the scriptlib
directory.

Jason

Assaf wrote:
> Hi,
>
> I'm looking to generate my reports while using my application java APIs
> (using DB datasource directly is too complex).
> SO is my only way is to use the scripted data set ? Can this work with
> the erport viewer ? Can I pass params within a request objet to the
> viewer ?
> I would like to continue to work with the viewer becuase of its
> extensive paging and export capabilities (basiclly to excel..)
>
> What are my other options to continue to work with the viewer but
> generate the data from my own java classes? (If I prodocue text files
> and use file datasource how can users generate reports at the same time ??)
>
> Thanks very much.
>
Re: Can the Report Viewer work with Scripted DataSets ? [message #263960 is a reply to message #263950] Sun, 06 January 2008 05:08 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: assaf.frank.dynasec.org

Thanks for the reply Jason,

Just a few more questions regarding scripted data sources:

1. Can I some how set the classpath of the viewer to a different location
(to
another application running on the same machine) ? I mean, I don't want
to
copy the classes to the
viewer application (either by jar or by regular classes) beacuse the
class
that retrieves the data for the scripted datasource relies on static
objects and static info from the original app (not only from DB
directly and I don't want to maintaine my code in two places)..

2. In sample java code that I found for passing objects to the report to
use
with the scripted data source -

String contextKey = "appContextKey";
request.setAttribute("AppContextKey",contextKey );

HashMap appContext = new HashMap( );
appContext.put( "key1", "value1" );
request.setAttribute( "AppContextValue",appContext );

request.getRequestDispatcher( "/frameset?

__report=testappcontext.rptdesign").forward(request,response);


All the access the to viewer is directly (/frameset?...) as if the java
code is in the same application as the viewer..
can I integrate the whole viewer application into my own application ?
Is this allowed ?

3. How do I access the AppContext in order to retrieve this parameter
within
the script code in the report design stage (in the eclipse).

Thanks very much!
Re: Can the Report Viewer work with Scripted DataSets ? [message #264147 is a reply to message #263960] Tue, 08 January 2008 14:43 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: jasonweathersby.alltel.net

Assaf,

1 - Is your other application in an Eclipse application?
2 - You should be able to integrate the viewer into your app. If your
app is an RCP app, it is pretty simple to use the viewer plugin. If
your app is a J2EE app you may want to look at using the tag libs. You
can set the script lib directory to an absolute directory for the viewer.
Look at this page to see a description of the tag libs.
http://www.eclipse.org/birt/phoenix/deploy/viewerUsage2.2.ph p

3- Currently you can not access this from the designer.

Jason

Assaf wrote:
> Thanks for the reply Jason,
>
> Just a few more questions regarding scripted data sources:
>
> 1. Can I some how set the classpath of the viewer to a different
> location (to another application running on the same machine) ? I
> mean, I don't want to copy the classes to the viewer application
> (either by jar or by regular classes) beacuse the class that retrieves
> the data for the scripted datasource relies on static objects and
> static info from the original app (not only from DB directly and I
> don't want to maintaine my code in two places)..
>
> 2. In sample java code that I found for passing objects to the report to
> use with the scripted data source -
>
> String contextKey = "appContextKey";
> request.setAttribute("AppContextKey",contextKey );
>
> HashMap appContext = new HashMap( );
> appContext.put( "key1", "value1" ); request.setAttribute(
> "AppContextValue",appContext );
>
> request.getRequestDispatcher( "/frameset?
> __report=testappcontext.rptdesign").forward(request,response);
>
>
> All the access the to viewer is directly (/frameset?...) as if the
> java code is in the same application as the viewer.. can I integrate
> the whole viewer application into my own application ?
> Is this allowed ?
> 3. How do I access the AppContext in order to retrieve this
> parameter within the script code in the report design stage (in the
> eclipse).
>
> Thanks very much!
>
>
Re: Can the Report Viewer work with Scripted DataSets ? [message #264185 is a reply to message #264147] Wed, 09 January 2008 01:53 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: assaf.frank.dynasec.org

Hi Jason .

1. My application is A J2EE application (only struts & jsps) that was
built in
IBM RAD7.0 . It runs on tomcat5.5 and uses JDBC to connect to MS-SQL.
It contains data in static variables and classes and therefore I wish to
run a class over there and pass the output java object to the viewer.
What would be the best way for doing this ?
2. I'm not sure what is a RCP application (see above for application desc)

Thanks.
Re: Can the Report Viewer work with Scripted DataSets ? [message #264249 is a reply to message #264185] Wed, 09 January 2008 20:07 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: jasonweathersby.alltel.net

In this case you may want to check out the WebViewer source code and add
it to your application.
Take a look at this page for building the viewer.

http://wiki.eclipse.org/BIRT/FAQ/Birt_Project#Q:_How_do_I_bu ild_the_2.2_BIRT_Viewer.3F

Jason

assaf wrote:
> Hi Jason .
>
> 1. My application is A J2EE application (only struts & jsps) that was
> built in
> IBM RAD7.0 . It runs on tomcat5.5 and uses JDBC to connect to MS-SQL.
> It contains data in static variables and classes and therefore I wish to
> run a class over there and pass the output java object to the viewer.
> What would be the best way for doing this ?
> 2. I'm not sure what is a RCP application (see above for application desc)
>
> Thanks.
>
Re: Can the Report Viewer work with Scripted DataSets ? [message #264273 is a reply to message #264249] Thu, 10 January 2008 05:20 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: assaf.frank.dynasec.org

So this will allow me to build the viewer within my app ?

I tried doing this (I imported the plugin -
org.eclipse.birt.report.viewer_2.2.1.r22x_v20070920 from the eclipse full
isntalation folder). The project that was created contained the folders -
about_files,birt,meta-inf,schema as well as several files
(viewer.jar,plugin.xml stc..).

The right click -> PDE Tools ->create ANT Build FILE on MANIFEST.MF (in
meta-inf) generated an error - "unable to find element -
org.eclipse.birt.report.viewer" .. The new project name created by the
plugin is exactly that - org.eclipse.birt.report.viewer

Any idea why this is ?

Thanks
Re: Can the Report Viewer work with Scripted DataSets ? [message #264276 is a reply to message #264273] Thu, 10 January 2008 08:42 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: assaf.frank.dynasec.org

Hi Jason,

Sorry for all this but this can really help me.
I didn't manage to do what you said before so I just tried to copy the
viewer folders from my working viewer app in tomcat into my application:
I copied as is all folders (webcontenet and empty -
attachments,scriptlib,logs,documents) , all contents of web-inf into my
application web-inf (when file already exists , like , web.xml , or lib
folder) I just added the birt specific content into my application web.xml
or jars in my lib folder)..

Finaly I tried to access the viewer by the same url as my application
(using the frameset servlet call) and managed to get the first page
(export,print buttons) of the viewer..but then get JS errors (object
expected) that stop the report (and no parmeter window pups up and so
on..)..

1. Can I expect the viewer to work this way ? (or am I wasting my time
here)
2. Any idea where the wrong JS paths need to be corrected

Thanks very much !
Re: Can the Report Viewer work with Scripted DataSets ? [message #264337 is a reply to message #264276] Fri, 11 January 2008 11:47 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: jasonweathersby.alltel.net

I have not tried this method, but it should work.
Can you try copying over the index.jsp and try calling in your new app?

Another option may be to take your existing app and write out the files
like you discussed earlier. You could name the files based on the
sessionid of your current app and then pass the name of the file as a
report parameter to the Viewer app. After the report processed the data
you could use the afterFactory event to delete the file.


Jason

assaf wrote:
> Hi Jason,
>
> Sorry for all this but this can really help me.
> I didn't manage to do what you said before so I just tried to copy the
> viewer folders from my working viewer app in tomcat into my application:
> I copied as is all folders (webcontenet and empty -
> attachments,scriptlib,logs,documents) , all contents of web-inf into my
> application web-inf (when file already exists , like , web.xml , or lib
> folder) I just added the birt specific content into my application
> web.xml or jars in my lib folder)..
>
> Finaly I tried to access the viewer by the same url as my application
> (using the frameset servlet call) and managed to get the first page
> (export,print buttons) of the viewer..but then get JS errors (object
> expected) that stop the report (and no parmeter window pups up and so
> on..)..
>
> 1. Can I expect the viewer to work this way ? (or am I wasting my time
> here)
> 2. Any idea where the wrong JS paths need to be corrected
>
> Thanks very much !
>
Re: Can the Report Viewer work with Scripted DataSets ? [message #264401 is a reply to message #264337] Sun, 13 January 2008 11:08 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: assaf.frank.dynasec.org

I tried to call the index.jsp from the birt viewer and the page
was displayed successfully.. the problem is that when I wish to display
the test report from the index page I get an error : (the class
org.mozilla.javascript.ImporterTopLevel is known in the application but I
did not see any initStandardObjects method - only init method)-

Any idea ?

-[ViewerServlet]: java.lang.NoSuchMethodError:
org.mozilla.javascript.ImporterTopLevel: method
initStandardObjects(Lorg/mozilla/javascript/Context;Z)V not found
at
org.eclipse.birt.core.script.ScriptContext.<init>(ScriptContext.java:80)
at
org.eclipse.birt.report.engine.executor.ExecutionContext.<init >(ExecutionContext.java:311)
at
org.eclipse.birt.report.engine.api.impl.EngineTask.<init>(EngineTask.java:160)
at
org.eclipse.birt.report.engine.api.impl.EngineTask.<init>(EngineTask.java:176)
at
org.eclipse.birt.report.engine.api.impl.GetParameterDefiniti onTask. <init>(GetParameterDefinitionTask.java:92)
at
org.eclipse.birt.report.engine.api.impl.ReportEngineHelper.c reateGetParameterDefinitionTask(ReportEngineHelper.java:298)
at
org.eclipse.birt.report.engine.api.impl.ReportEngine.createG etParameterDefinitionTask(ReportEngine.java:318)
at
org.eclipse.birt.report.service.ReportEngineService.createGe tParameterDefinitionTask(Unknown
Source)
at
org.eclipse.birt.report.service.BirtViewerReportService.getP arameterDefinitionTask(Unknown
Source)
at
org.eclipse.birt.report.service.BirtViewerReportService.getP arameterDefinitions(Unknown
Source)
at
org.eclipse.birt.report.context.ViewerAttributeBean.__initPa rameters(Unknown
Source)
at org.eclipse.birt.report.context.ViewerAttributeBean.__init(U nknown
Source)
at org.eclipse.birt.report.context.BaseAttributeBean.init(Unkno wn Source)
at org.eclipse.birt.report.context.ViewerAttributeBean.<init>(Unknown
Source)
at org.eclipse.birt.report.context.BirtContext.__init(Unknown Source)
at org.eclipse.birt.report.context.BaseContext.<init>(Unknown Source)
at org.eclipse.birt.report.context.BirtContext.<init>(Unknown Source)
at org.eclipse.birt.report.servlet.ViewerServlet.__getContext(U nknown
Source)
at
org.eclipse.birt.report.servlet.BirtSoapMessageDispatcherSer vlet.doGet(Unknown
Source)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:743)
at
org.apache.axis.transport.http.AxisServletBase.service(AxisS ervletBase.java:327)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
at
com.ibm.ws.webcontainer.servlet.ServletWrapper.service(Servl etWrapper.java:1572)
at
com.ibm.ws.webcontainer.servlet.ServletWrapper.service(Servl etWrapper.java:1521)
at
com.ibm.ws.webcontainer.filter.WebAppFilterChain.doFilter(We bAppFilterChain.java:136)
at org.eclipse.birt.report.filter.ViewerFilter.doFilter(Unknown Source)
at
com.ibm.ws.webcontainer.filter.FilterInstanceWrapper.doFilte r(FilterInstanceWrapper.java:142)
at
com.ibm.ws.webcontainer.filter.WebAppFilterChain.doFilter(We bAppFilterChain.java:121)
at
com.ibm.ws.webcontainer.filter.WebAppFilterChain._doFilter(W ebAppFilterChain.java:82)
at
com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest (ServletWrapper.java:759)
at com.ibm.ws.webcontainer.webapp.WebApp.handleRequest(WebApp.j ava:3071)
at
com.ibm.ws.webcontainer.webapp.WebGroup.handleRequest(WebGro up.java:236)
at com.ibm.ws.webcontainer.VirtualHost.handleRequest(VirtualHos t.java:210)
at
com.ibm.ws.webcontainer.WebContainer.handleRequest(WebContai ner.java:1958)
at
com.ibm.ws.webcontainer.channel.WCChannelLink.ready(WCChanne lLink.java:89)
at
com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleD iscrimination(HttpInboundLink.java:472)
at
com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleN ewInformation(HttpInboundLink.java:411)
at
com.ibm.ws.http.channel.inbound.impl.HttpICLReadCallback.com plete(HttpICLReadCallback.java:101)
at
com.ibm.ws.tcp.channel.impl.WorkQueueManager.requestComplete (WorkQueueManager.java:566)
at
com.ibm.ws.tcp.channel.impl.WorkQueueManager.attemptIO(WorkQ ueueManager.java:619)
at
com.ibm.ws.tcp.channel.impl.WorkQueueManager.workerRun(WorkQ ueueManager.java:952)
at
com.ibm.ws.tcp.channel.impl.WorkQueueManager$Worker.run(Work QueueManager.java:1039)
at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:1471)
Re: Can the Report Viewer work with Scripted DataSets ? [message #264405 is a reply to message #264401] Sun, 13 January 2008 12:56 Go to previous message
Eclipse UserFriend
org.mozilla.javascript.ImporterTopLevel is placed in the
org.mozilla.rhino plugin and contains the initStandardObject method.
It is possible that your application loads this class from some other
location. I suppose that you have js.jar within your application that
isn't compatible with BIRT.

Snjeza

assaf wrote:
> I tried to call the index.jsp from the birt viewer and the page was
> displayed successfully.. the problem is that when I wish to display the
> test report from the index page I get an error : (the class
> org.mozilla.javascript.ImporterTopLevel is known in the application but
> I did not see any initStandardObjects method - only init method)-
>
> Any idea ?
> -[ViewerServlet]: java.lang.NoSuchMethodError:
> org.mozilla.javascript.ImporterTopLevel: method
> initStandardObjects(Lorg/mozilla/javascript/Context;Z)V not found
> at
> org.eclipse.birt.core.script.ScriptContext.<init>(ScriptContext.java:80)
> at
> org.eclipse.birt.report.engine.executor.ExecutionContext.<init >(ExecutionContext.java:311)
>
> at
> org.eclipse.birt.report.engine.api.impl.EngineTask.<init>(EngineTask.java:160)
>
> at
> org.eclipse.birt.report.engine.api.impl.EngineTask.<init>(EngineTask.java:176)
>
> at
> org.eclipse.birt.report.engine.api.impl.GetParameterDefiniti onTask. <init>(GetParameterDefinitionTask.java:92)
>
> at
> org.eclipse.birt.report.engine.api.impl.ReportEngineHelper.c reateGetParameterDefinitionTask(ReportEngineHelper.java:298)
>
> at
> org.eclipse.birt.report.engine.api.impl.ReportEngine.createG etParameterDefinitionTask(ReportEngine.java:318)
>
> at
> org.eclipse.birt.report.service.ReportEngineService.createGe tParameterDefinitionTask(Unknown
> Source)
> at
> org.eclipse.birt.report.service.BirtViewerReportService.getP arameterDefinitionTask(Unknown
> Source)
> at
> org.eclipse.birt.report.service.BirtViewerReportService.getP arameterDefinitions(Unknown
> Source)
> at
> org.eclipse.birt.report.context.ViewerAttributeBean.__initPa rameters(Unknown
> Source)
> at
> org.eclipse.birt.report.context.ViewerAttributeBean.__init(U nknown Source)
> at org.eclipse.birt.report.context.BaseAttributeBean.init(Unkno wn
> Source)
> at
> org.eclipse.birt.report.context.ViewerAttributeBean.<init>(Unknown Source)
> at org.eclipse.birt.report.context.BirtContext.__init(Unknown Source)
> at org.eclipse.birt.report.context.BaseContext.<init>(Unknown Source)
> at org.eclipse.birt.report.context.BirtContext.<init>(Unknown Source)
> at
> org.eclipse.birt.report.servlet.ViewerServlet.__getContext(U nknown Source)
> at
> org.eclipse.birt.report.servlet.BirtSoapMessageDispatcherSer vlet.doGet(Unknown
> Source)
> at javax.servlet.http.HttpServlet.service(HttpServlet.java:743)
> at
> org.apache.axis.transport.http.AxisServletBase.service(AxisS ervletBase.java:327)
>
> at javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
> at
> com.ibm.ws.webcontainer.servlet.ServletWrapper.service(Servl etWrapper.java:1572)
>
> at
> com.ibm.ws.webcontainer.servlet.ServletWrapper.service(Servl etWrapper.java:1521)
>
> at
> com.ibm.ws.webcontainer.filter.WebAppFilterChain.doFilter(We bAppFilterChain.java:136)
>
> at org.eclipse.birt.report.filter.ViewerFilter.doFilter(Unknown Source)
> at
> com.ibm.ws.webcontainer.filter.FilterInstanceWrapper.doFilte r(FilterInstanceWrapper.java:142)
>
> at
> com.ibm.ws.webcontainer.filter.WebAppFilterChain.doFilter(We bAppFilterChain.java:121)
>
> at
> com.ibm.ws.webcontainer.filter.WebAppFilterChain._doFilter(W ebAppFilterChain.java:82)
>
> at
> com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest (ServletWrapper.java:759)
>
> at
> com.ibm.ws.webcontainer.webapp.WebApp.handleRequest(WebApp.j ava:3071)
> at
> com.ibm.ws.webcontainer.webapp.WebGroup.handleRequest(WebGro up.java:236)
> at
> com.ibm.ws.webcontainer.VirtualHost.handleRequest(VirtualHos t.java:210)
> at
> com.ibm.ws.webcontainer.WebContainer.handleRequest(WebContai ner.java:1958)
> at
> com.ibm.ws.webcontainer.channel.WCChannelLink.ready(WCChanne lLink.java:89)
> at
> com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleD iscrimination(HttpInboundLink.java:472)
>
> at
> com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleN ewInformation(HttpInboundLink.java:411)
>
> at
> com.ibm.ws.http.channel.inbound.impl.HttpICLReadCallback.com plete(HttpICLReadCallback.java:101)
>
> at
> com.ibm.ws.tcp.channel.impl.WorkQueueManager.requestComplete (WorkQueueManager.java:566)
>
> at
> com.ibm.ws.tcp.channel.impl.WorkQueueManager.attemptIO(WorkQ ueueManager.java:619)
>
> at
> com.ibm.ws.tcp.channel.impl.WorkQueueManager.workerRun(WorkQ ueueManager.java:952)
>
> at
> com.ibm.ws.tcp.channel.impl.WorkQueueManager$Worker.run(Work QueueManager.java:1039)
>
> at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:1471)
Previous Topic:AppContext Class Cast Exception
Next Topic:BIRT runtime dynamic chart scaling
Goto Forum:
  


Current Time: Mon Aug 18 00:01:22 EDT 2025

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

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

Back to the top