Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Archived » BIRT » Using Java Objects access a Data Source
Using Java Objects access a Data Source [message #205189] Wed, 06 December 2006 23:21 Go to next message
Eclipse UserFriend
Originally posted by: twindham.ugaais.com

This is a multi-part message in MIME format.

------=_NextPart_000_00E6_01C7195A.FD547470
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

Hello all,

I'm trying to implement the "Tutorial #2: Creating a Scripted Data =
Source" that is layed out in the book Integrating and Extending Birt on =
page 133.

Everything works great until I try to implement the section called =
"Using Java Objects to Access a Data Source".

I have a class called TestDataSource.java

package com.hmamg.quote;import java.util.ArrayList;import =
java.util.Iterator;public class TestDataSource { public static Iterator =
getListIterator() { ArrayList retval =3D new ArrayList(); =
retval.add(new SomeDataObject(33, "First Item")); retval.add(new =
SomeDataObject(54, "Second Item")); return retval.iterator(); } static =
class SomeDataObject { public SomeDataObject(int rate, String name) { =
this.rate =3D rate; this.name =3D name; } private int rate; =
private String name; public String getName() { return name; } =
public void setName(String name) { this.name =3D name; } public int =
getRate() { return rate; } public void setRate(int rate) { =
this.rate =3D rate; } }}I try to access this class in my script method =
called open() on the Scripted Data Set that I created earlier in the =
tutorial

importPackage(Packages.com.hmamg.quote);var myList =3D =
Packages.com.hmamg.quote.TestDataSource.getList();var iter =3D =
myList.getIterator();And here's the script called fetch()

if(iter.hasNext() =3D=3D false){return false;}var node =3D =
iter.next();row[1] =3D node.getRate();row[2] =3D node.getName();return =
true;

I have defined the two columns in the report, and I am trying to show =
them in a table just like I did in the earlier parts of Tutorial Two.

And this is from the stack trace that the report throws when trying to =
run it.

The following items have errors: Table (id =3D 6): - There are errors =
evaluating script "importPackage(Packages.com.hmamg.quote);var myList =
=3D Packages.com.hmamg.quote.TestDataSource.getList();var iter =3D =
myList.getIterator();". Error.ScriptEvaluationError ( 1 time(s) )
detail : org.eclipse.birt.report.engine.api.EngineException: There are =
errors evaluating script "importPackage(Packages.com.hmamg.quote);var =
myList =3D Packages.com.hmamg.quote.TestDataSource.getList();var iter =
=3D myList.getIterator();recordCount =3D 0;". at =
org.eclipse.birt.report.engine.script.internal.DtEScriptExec utor.handleJS=
(DtEScriptExecutor.java:76) at =
org.eclipse.birt.report.engine.script.internal.DataSetScript Executor.hand=
leJS(DataSetScriptExecutor.java:159) at =
org.eclipse.birt.report.engine.script.internal.ScriptDataSet ScriptExecuto=
r.handleOpen(ScriptDataSetScriptExecutor.java:66) at =
org.eclipse.birt.data.engine.impl.ScriptDataSetRuntime.open( ScriptDataSet=
Runtime.java:68) at =
org.eclipse.birt.data.engine.impl.PreparedScriptDSQuery$Scri ptDSQueryExec=
utor$CustomDataSet.open(PreparedScriptDSQuery.java:233) at =
org.eclipse.birt.data.engine.impl.PreparedScriptDSQuery$Scri ptDSQueryExec=
utor.executeOdiQuery(PreparedScriptDSQuery.java:209) at =
org.eclipse.birt.data.engine.impl.QueryExecutor.execute(Quer yExecutor.jav=
a:735) at =
org.eclipse.birt.data.engine.impl.ServiceForQueryResults.exe cuteQuery(Ser=
viceForQueryResults.java:181) at =
org.eclipse.birt.data.engine.impl.QueryResults.getResultIter ator(QueryRes=
ults.java:137) at =
org.eclipse.birt.report.engine.data.dte.DteResultSet.<init>(DteResultSet.=
java:86) at =
org.eclipse.birt.report.engine.data.dte.DteDataEngine.doExec uteQuery(DteD=
ataEngine.java:115) at =
org.eclipse.birt.report.engine.data.dte.AbstractDataEngine.e xecute(Abstra=
ctDataEngine.java:208) at =
org.eclipse.birt.report.engine.executor.ExecutionContext.exe cuteQuery(Exe=
cutionContext.java:1640) at =
org.eclipse.birt.report.engine.executor.QueryItemExecutor.ex ecuteQuery(Qu=
eryItemExecutor.java:62) at =
org.eclipse.birt.report.engine.executor.TableItemExecutor.ex ecute(TableIt=
emExecutor.java:74) at =
org.eclipse.birt.report.engine.internal.executor.l18n.Locali zedReportItem=
Executor.execute(LocalizedReportItemExecutor.java:35) at =
org.eclipse.birt.report.engine.layout.html.HTMLPageLM.layout Children(HTML=
PageLM.java:123) at =
org.eclipse.birt.report.engine.layout.html.HTMLPageLM.layout (HTMLPageLM.j=
ava:81) at =
org.eclipse.birt.report.engine.layout.html.HTMLReportLayoutE ngine.layout(=
HTMLReportLayoutEngine.java:80) at =
org.eclipse.birt.report.engine.api.impl.RunAndRenderTask.run (RunAndRender=
Task.java:194) at =
com.hmamg.reporting.ReportRunner.runReport(ReportRunner.java :163) at =
com.hmamg.reporting.ReportRunner.runHTMLReport(ReportRunner. java:119) at =
com.hmamg.quote.mediators.QuotePreviewMediator.runReport(Quo tePreviewMedi=
ator.java:173) at =
com.hmamg.quote.mediators.QuotePreviewMediator.access$0(Quot ePreviewMedia=
tor.java:169) at =
com.hmamg.quote.mediators.QuotePreviewMediator$1.run(QuotePr eviewMediator=
..java:72) at =
org.eclipse.swt.custom.BusyIndicator.showWhile(BusyIndicator .java:67) at =
com.hmamg.quote.mediators.QuotePreviewMediator.calculate(Quo tePreviewMedi=
ator.java:75) at =
com.hmamg.quote.mediators.QuotePreviewMediator.focusGained(Q uotePreviewMe=
diator.java:219) at =
com.hmamg.quote.components.QuoteTabComposite.updateFocus(Quo teTabComposit=
e.java:97) at =
com.hmamg.quote.components.QuoteTabComposite.access$0(QuoteT abComposite.j=
ava:82) at =
com.hmamg.quote.components.QuoteTabComposite$1.widgetSelecte d(QuoteTabCom=
posite.java:77) at =
org.eclipse.swt.widgets.TypedListener.handleEvent(TypedListe ner.java:90) =
at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java :66) at =
org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:928) at =
org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:952) at =
org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:937) at =
org.eclipse.swt.widgets.Widget.notifyListeners(Widget.java:7 09) at =
org.eclipse.swt.custom.CTabFolder.setSelection(CTabFolder.ja va:3171) at =
org.eclipse.swt.custom.CTabFolder.onMouse(CTabFolder.java:19 53) at =
org.eclipse.swt.custom.CTabFolder$1.handleEvent(CTabFolder.j ava:288) at =
org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java :66) at =
org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:928) at =
org.eclipse.swt.widgets.Display.runDeferredEvents(Display.ja va:3348) at =
org.eclipse.swt.widgets.Display.readAndDispatch(Display.java :2968) at =
org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.jav a:1914) at =
org.eclipse.ui.internal.Workbench.runUI(Workbench.java:1878) at =
org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Work bench.java:41=
9) at =
org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.j ava:149) at =
com.hmamg.application.welcome.Application.run(Application.ja va:105) at =
org.eclipse.core.internal.runtime.PlatformActivator$1.run(Pl atformActivat=
or.java:78) at =
org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher .runApplicati=
on(EclipseAppLauncher.java:92) at =
org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher .start(Eclips=
eAppLauncher.java:68) at =
org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseS tarter.java:4=
00) at =
org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseS tarter.java:1=
77) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at =
sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at =
sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at =
java.lang.reflect.Method.invoke(Unknown Source) at =
org.eclipse.core.launcher.Main.invokeFramework(Main.java:336 ) at =
org.eclipse.core.launcher.Main.basicRun(Main.java:280) at =
org.eclipse.core.launcher.Main.run(Main.java:977) at =
org.eclipse.core.launcher.Main.main(Main.java:952)Caused by: =
org.eclipse.birt.data.engine.core.DataException: A BIRT exception =
occurred: Error evaluating Javascript expression. Script engine error: =
TypeError: getList is not a function. (DataSet[Scripted Data =
Set].__bm_OPEN#4) Script source: DataSet[Scripted Data Set].__bm_OPEN, =
line: 1, text:__bm_OPEN(). See next exception for more information.Error =
evaluating Javascript expression. Script engine error: TypeError: =
getList is not a function. (DataSet[Scripted Data Set].__bm_OPEN#4) =
Script source: DataSet[Scripted Data Set].__bm_OPEN, line: 1, =
text:__bm_OPEN() at =
org.eclipse.birt.data.engine.core.DataException.wrap(DataExc eption.java:1=
18) at =
org.eclipse.birt.data.engine.script.ScriptEvalUtil.evaluateJ SAsExpr(Scrip=
tEvalUtil.java:552) at =
org.eclipse.birt.data.engine.script.JSMethodRunner.runScript (JSMethodRunn=
er.java:79) at =
org.eclipse.birt.report.engine.script.internal.DtEScriptExec utor.handleJS=
(DtEScriptExecutor.java:71) ... 61 moreCaused by: =
org.eclipse.birt.core.exception.CoreException: Error evaluating =
Javascript expression. Script engine error: TypeError: getList is not a =
function. (DataSet[Scripted Data Set].__bm_OPEN#4) Script source: =
DataSet[Scripted Data Set].__bm_OPEN, line: 1, text:__bm_OPEN() at =
org.eclipse.birt.core.script.JavascriptEvalUtil.wrapRhinoExc eption(Javasc=
riptEvalUtil.java:281) at =
org.eclipse.birt.core.script.JavascriptEvalUtil.evaluateRawS cript(Javascr=
iptEvalUtil.java:105) at =
org.eclipse.birt.core.script.JavascriptEvalUtil.evaluateScri pt(Javascript=
EvalUtil.java:137) at =
org.eclipse.birt.data.engine.script.ScriptEvalUtil.evaluateJ SAsExpr(Scrip=
tEvalUtil.java:548) ... 63 moreCaused by: =
org.mozilla.javascript.EcmaError: TypeError: getList is not a function. =
(DataSet[Scripted Data Set].__bm_OPEN#4) at =
org.mozilla.javascript.ScriptRuntime.constructError(ScriptRu ntime.java:32=
40) at =
org.mozilla.javascript.ScriptRuntime.constructError(ScriptRu ntime.java:32=
30) at =
org.mozilla.javascript.ScriptRuntime.typeError(ScriptRuntime .java:3246) =
at =
org.mozilla.javascript.ScriptRuntime.typeError1(ScriptRuntim e.java:3258) =
at =
org.mozilla.javascript.ScriptRuntime.notFunctionError(Script Runtime.java:=
3317) at =
org.mozilla.javascript.ScriptRuntime.getPropFunctionAndThis( ScriptRuntime=
..java:1987) at =
org.mozilla.javascript.optimizer.OptRuntime.callProp0(OptRun time.java:114=
) at org.mozilla.javascript.gen.c6._c1(DataSet[Scripted Data =
Set].__bm_OPEN:4) at org.mozilla.javascript.gen.c6.call(DataSet[Scripted =
Data Set].__bm_OPEN) at =
org.mozilla.javascript.optimizer.OptRuntime.callName0(OptRun time.java:105=
) at org.mozilla.javascript.gen.c5._c0(DataSource[Scripted Data =
Source].__bm_OPEN:1) at =
org.mozilla.javascript.gen.c5.call(DataSource[Scripted Data =
Source].__bm_OPEN) at =
org.mozilla.javascript.ContextFactory.doTopCall(ContextFacto ry.java:304) =
at =
org.mozilla.javascript.ScriptRuntime.doTopCall(ScriptRuntime .java:2769) =
at org.mozilla.javascript.gen.c5.call(DataSource[Scripted Data =
Source].__bm_OPEN) at =
org.mozilla.javascript.gen.c5.exec(DataSource[Scripted Data =
Source].__bm_OPEN) at =
org.eclipse.birt.core.script.JavascriptEvalUtil.evaluateRawS cript(Javascr=
iptEvalUtil.java:98) ... 65 moreI am working on an RCP project. The =
report file and the java object in question are in the same plug-in =
project. I am using the RE API (Report Engine API) to produce my report =
in an SWT Browser widget. I can successfully run a report that has no =
data set created. =20

I think my problem is a complete lack of knowledge of JavaScript. I =
have no idea where to start debugging the script methods.

Help me Jason Weathersby, you're my only hope. I am on a tight =
deadline, and this is the last big feature to implement before my RCP =
application has to ship.

Thanks,
Trace Windham

PS... See you at Eclipse Con 2007
------=_NextPart_000_00E6_01C7195A.FD547470
Content-Type: text/html;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=3DContent-Type content=3D"text/html; =
charset=3Diso-8859-1">
<META content=3D"MSHTML 6.00.2900.2912" name=3DGENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY>
<DIV><FONT face=3DArial color=3D#0000ff size=3D2>Hello all,</FONT></DIV>
<DIV><FONT face=3DArial color=3D#0000ff size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial color=3D#0000ff size=3D2>I'm trying to implement =
the "Tutorial=20
#2: Creating a Scripted Data Source"&nbsp;that is layed out in =
the&nbsp;book=20
<EM><STRONG>Integrating and Extending Birt</STRONG></EM> on page=20
133.</FONT></DIV>
<DIV><FONT face=3DArial color=3D#0000ff size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial color=3D#0000ff size=3D2>Everything works great =
until I try to=20
implement the section called "Using Java Objects to Access a Data=20
Source".</FONT></DIV>
<DIV><FONT face=3DArial color=3D#0000ff size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial color=3D#0000ff size=3D2>I have a class called=20
TestDataSource.java</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<BLOCKQUOTE dir=3Dltr style=3D"MARGIN-RIGHT: 0px"><PRE>package =
com.hmamg.quote;</PRE><PRE>import java.util.ArrayList;<BR>import =
java.util.Iterator;</PRE><PRE>public class TestDataSource =
{<BR>&nbsp;<BR>&nbsp;public static Iterator getListIterator() =
{<BR>&nbsp;&nbsp;ArrayList retval =3D new =
ArrayList();<BR>&nbsp;&nbsp;retval.add(new SomeDataObject(33, "First =
Item"));<BR>&nbsp;&nbsp;retval.add(new SomeDataObject(54, "Second =
Item"));<BR>&nbsp;&nbsp;return =
retval.iterator();<BR>&nbsp;}<BR>&nbsp;<BR>&nbsp;static class =
SomeDataObject {<BR>&nbsp;&nbsp;public SomeDataObject(int rate, String =
name) {<BR>&nbsp;&nbsp;&nbsp;this.rate =3D =
rate;<BR>&nbsp;&nbsp;&nbsp;this.name =3D =
name;<BR>&nbsp;&nbsp;}</PRE><PRE>&nbsp;&nbsp;private int =
rate;<BR>&nbsp;&nbsp;<BR>&nbsp;&nbsp;private String =
name;</PRE><PRE>&nbsp;&nbsp;public String getName() =
{<BR>&nbsp;&nbsp;&nbsp;return =
name;<BR>&nbsp;&nbsp;}</PRE><PRE>&nbsp;&nbsp;public void setName(String =
name) {<BR>&nbsp;&nbsp;&nbsp;this.name =3D =
name;<BR>&nbsp;&nbsp;}</PRE><PRE>&nbsp;&nbsp;public int getRate() =
{<BR>&nbsp;&nbsp;&nbsp;return =
rate;<BR>&nbsp;&nbsp;}</PRE><PRE>&nbsp;&nbsp;public void setRate(int =
rate) {<BR>&nbsp;&nbsp;&nbsp;this.rate =3D =
rate;<BR>&nbsp;&nbsp;}<BR>&nbsp;}<BR>}<BR ></PRE></BLOCKQUOTE>
<DIV><FONT face=3DArial color=3D#0000ff size=3D2>I try to access this =
class in my=20
script method called <EM>open()</EM> on the Scripted Data Set that I =
created=20
earlier in the tutorial</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<BLOCKQUOTE dir=3Dltr style=3D"MARGIN-RIGHT: =
0px"><PRE>importPackage(Packages.com.hmamg.quote);</PRE><PRE >var myList =
=3D Packages.com.hmamg.quote.TestDataSource.getList();</PRE><PRE >var =
iter =3D myList.getIterator();</PRE></BLOCKQUOTE>
<P dir=3Dltr><FONT face=3DArial size=3D2><FONT color=3D#0000ff>And =
here's the script=20
called <EM>fetch()</EM></FONT></FONT></P>
<BLOCKQUOTE dir=3Dltr style=3D"MARGIN-RIGHT: 0px"><PRE>if(iter.hasNext() =
=3D=3D false){</PRE><PRE>return false;</PRE><PRE>}</PRE><PRE>var node =
=3D iter.next();</PRE><PRE>row[1] =3D node.getRate();</PRE><PRE>row[2] =
=3D node.getName();</PRE><PRE>return true;</PRE></BLOCKQUOTE>
<P dir=3Dltr><FONT face=3DArial size=3D2><FONT =
color=3D#0000ff></FONT></FONT>&nbsp;</P>
<P dir=3Dltr><FONT face=3DArial color=3D#0000ff size=3D2>I have defined =
the two columns=20
in the report, and I am trying to show them in a table just like I did =
in the=20
earlier parts of Tutorial Two.</FONT></P>
<P dir=3Dltr><FONT face=3DArial size=3D2><FONT color=3D#0000ff>And this =
is from the=20
stack trace that the report throws when trying to run =
it</FONT>.</FONT></P>
<BLOCKQUOTE dir=3Dltr style=3D"MARGIN-RIGHT: 0px"><PRE =
dir=3Dltr><DIV>The following items have errors: </DIV><BR><DIV><DIV =
id=3Derror_title style=3D"TEXT-DECORATION: underline">Table (id =3D 6): =
</DIV><DIV><SPAN id=3Derror_icon0_0 style=3D"CURSOR: pointer" =
onclick=3D"if (document.getElementById('error_detail0_0').style.display =
=3D=3D 'none') { document.getElementById('error_icon0_0').innerHTML =3D =
'- '; document.getElementById('error_detail0_0').style.display =3D =
'block'; }else { document.getElementById('error_icon0_0').innerHTML =3D =
'+ '; document.getElementById('error_detail0_0').style.display =3D =
'none'; }">- </SPAN>There are errors evaluating script =
"importPackage(Packages.com.hmamg.quote);<BR><BR>var myList =3D =
Packages.com.hmamg.quote.TestDataSource.getList();<BR>var iter =3D =
myList.getIterator();". <PRE id=3Derror_detail0_0 style=3D"DISPLAY: =
block">Error.ScriptEvaluationError ( 1 time(s) )
detail : org.eclipse.birt.report.engine.api.EngineException: There are =
errors evaluating script =
"importPackage(Packages.com.hmamg.quote);<BR><BR>var myList =3D =
Packages.com.hmamg.quote.TestDataSource.getList();<BR>var iter =3D =
myList.getIterator();<BR>recordCount =3D 0;".<BR>&nbsp;at =
org.eclipse.birt.report.engine.script.internal.DtEScriptExec utor.handleJS=
(DtEScriptExecutor.java:76)<BR>&nbsp;at =
org.eclipse.birt.report.engine.script.internal.DataSetScript Executor.hand=
leJS(DataSetScriptExecutor.java:159)<BR>&nbsp;at =
org.eclipse.birt.report.engine.script.internal.ScriptDataSet ScriptExecuto=
r.handleOpen(ScriptDataSetScriptExecutor.java:66)<BR>&nbsp;at =
org.eclipse.birt.data.engine.impl.ScriptDataSetRuntime.open( ScriptDataSet=
Runtime.java:68)<BR>&nbsp;at =
org.eclipse.birt.data.engine.impl.PreparedScriptDSQuery$Scri ptDSQueryExec=
utor$CustomDataSet.open(PreparedScriptDSQuery.java:233)<BR>&nbsp;at =
org.eclipse.birt.data.engine.impl.PreparedScriptDSQuery$Scri ptDSQueryExec=
utor.executeOdiQuery(PreparedScriptDSQuery.java:209)<BR>&nbsp;at =
org.eclipse.birt.data.engine.impl.QueryExecutor.execute(Quer yExecutor.jav=
a:735)<BR>&nbsp;at =
org.eclipse.birt.data.engine.impl.ServiceForQueryResults.exe cuteQuery(Ser=
viceForQueryResults.java:181)<BR>&nbsp;at =
org.eclipse.birt.data.engine.impl.QueryResults.getResultIter ator(QueryRes=
ults.java:137)<BR>&nbsp;at =
org.eclipse.birt.report.engine.data.dte.DteResultSet.&lt ;init&gt;(DteResu=
ltSet.java:86)<BR>&nbsp;at =
org.eclipse.birt.report.engine.data.dte.DteDataEngine.doExec uteQuery(DteD=
ataEngine.java:115)<BR>&nbsp;at =
org.eclipse.birt.report.engine.data.dte.AbstractDataEngine.e xecute(Abstra=
ctDataEngine.java:208)<BR>&nbsp;at =
org.eclipse.birt.report.engine.executor.ExecutionContext.exe cuteQuery(Exe=
cutionContext.java:1640)<BR>&nbsp;at =
org.eclipse.birt.report.engine.executor.QueryItemExecutor.ex ecuteQuery(Qu=
eryItemExecutor.java:62)<BR>&nbsp;at =
org.eclipse.birt.report.engine.executor.TableItemExecutor.ex ecute(TableIt=
emExecutor.java:74)<BR>&nbsp;at =
org.eclipse.birt.report.engine.internal.executor.l18n.Locali zedReportItem=
Executor.execute(LocalizedReportItemExecutor.java:35)<BR>&nbsp;at =
org.eclipse.birt.report.engine.layout.html.HTMLPageLM.layout Children(HTML=
PageLM.java:123)<BR>&nbsp;at =
org.eclipse.birt.report.engine.layout.html.HTMLPageLM.layout (HTMLPageLM.j=
ava:81)<BR>&nbsp;at =
org.eclipse.birt.report.engine.layout.html.HTMLReportLayoutE ngine.layout(=
HTMLReportLayoutEngine.java:80)<BR>&nbsp;at =
org.eclipse.birt.report.engine.api.impl.RunAndRenderTask.run (RunAndRender=
Task.java:194)<BR>&nbsp;at =
com.hmamg.reporting.ReportRunner.runReport(ReportRunner.java :163) <BR>&nbs=
p;at =
com.hmamg.reporting.ReportRunner.runHTMLReport(ReportRunner. java:119) <BR>=
&nbsp;at =
com.hmamg.quote.mediators.QuotePreviewMediator.runReport(Quo tePreviewMedi=
ator.java:173)<BR>&nbsp;at =
com.hmamg.quote.mediators.QuotePreviewMediator.access$0(Quot ePreviewMedia=
tor.java:169)<BR>&nbsp;at =
com.hmamg.quote.mediators.QuotePreviewMediator$1.run(QuotePr eviewMediator=
..java:72)<BR>&nbsp;at =
org.eclipse.swt.custom.BusyIndicator.showWhile(BusyIndicator .java:67) <BR>=
&nbsp;at =
com.hmamg.quote.mediators.QuotePreviewMediator.calculate(Quo tePreviewMedi=
ator.java:75)<BR>&nbsp;at =
com.hmamg.quote.mediators.QuotePreviewMediator.focusGained(Q uotePreviewMe=
diator.java:219)<BR>&nbsp;at =
com.hmamg.quote.components.QuoteTabComposite.updateFocus(Quo teTabComposit=
e.java:97)<BR>&nbsp;at =
com.hmamg.quote.components.QuoteTabComposite.access$0(QuoteT abComposite.j=
ava:82)<BR>&nbsp;at =
com.hmamg.quote.components.QuoteTabComposite$1.widgetSelecte d(QuoteTabCom=
posite.java:77)<BR>&nbsp;at =
org.eclipse.swt.widgets.TypedListener.handleEvent(TypedListe ner.java:90) <=
BR>&nbsp;at =
org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java :66) <BR>&nbsp=
;at =
org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:928)<BR >&nbsp;at =
org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:952)<BR >&nbsp;at =
org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:937)<BR >&nbsp;at =
org.eclipse.swt.widgets.Widget.notifyListeners(Widget.java:7 09) <BR>&nbsp;=
at =
org.eclipse.swt.custom.CTabFolder.setSelection(CTabFolder.ja va:3171) <BR>&=
nbsp;at =
org.eclipse.swt.custom.CTabFolder.onMouse(CTabFolder.java:19 53) <BR>&nbsp;=
at =
org.eclipse.swt.custom.CTabFolder$1.handleEvent(CTabFolder.j ava:288) <BR>&=
nbsp;at =
org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java :66) <BR>&nbsp=
;at =
org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:928)<BR >&nbsp;at =
org.eclipse.swt.widgets.Display.runDeferredEvents(Display.ja va:3348) <BR>&=
nbsp;at =
org.eclipse.swt.widgets.Display.readAndDispatch(Display.java :2968) <BR>&nb=
sp;at =
org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.jav a:1914) <BR>&n=
bsp;at =
org.eclipse.ui.internal.Workbench.runUI(Workbench.java:1878) <BR>&nbsp;at =
org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Work bench.java:41=
9)<BR>&nbsp;at =
org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.j ava:149) <BR>&=
nbsp;at =
com.hmamg.application.welcome.Application.run(Application.ja va:105) <BR>&n=
bsp;at =
org.eclipse.core.internal.runtime.PlatformActivator$1.run(Pl atformActivat=
or.java:78)<BR>&nbsp;at =
org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher .runApplicati=
on(EclipseAppLauncher.java:92)<BR>&nbsp;at =
org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher .start(Eclips=
eAppLauncher.java:68)<BR>&nbsp;at =
org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseS tarter.java:4=
00)<BR>&nbsp;at =
org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseS tarter.java:1=
77)<BR>&nbsp;at sun.reflect.NativeMethodAccessorImpl.invoke0(Native =
Method)<BR>&nbsp;at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown =
Source)<BR>&nbsp;at =
sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown =
Source)<BR>&nbsp;at java.lang.reflect.Method.invoke(Unknown =
Source)<BR>&nbsp;at =
org.eclipse.core.launcher.Main.invokeFramework(Main.java:336 ) <BR>&nbsp;at=
org.eclipse.core.launcher.Main.basicRun(Main.java:280)<BR>&nbsp;at =
org.eclipse.core.launcher.Main.run(Main.java:977)<BR>&nbsp;at =
org.eclipse.core.launcher.Main.main(Main.java:952)<BR>Caused by: =
org.eclipse.birt.data.engine.core.DataException: A BIRT exception =
occurred: Error evaluating Javascript expression. Script engine error: =
TypeError: getList is not a function. (DataSet[Scripted Data =
Set].__bm_OPEN#4)<BR> Script source: DataSet[Scripted Data =
Set].__bm_OPEN, line: 1, text:<BR>__bm_OPEN(). See next exception for =
more information.<BR>Error evaluating Javascript expression. Script =
engine error: TypeError: getList is not a function. (DataSet[Scripted =
Data Set].__bm_OPEN#4)<BR> Script source: DataSet[Scripted Data =
Set].__bm_OPEN, line: 1, text:<BR>__bm_OPEN()<BR>&nbsp;at =
org.eclipse.birt.data.engine.core.DataException.wrap(DataExc eption.java:1=
18)<BR>&nbsp;at =
org.eclipse.birt.data.engine.script.ScriptEvalUtil.evaluateJ SAsExpr(Scrip=
tEvalUtil.java:552)<BR>&nbsp;at =
org.eclipse.birt.data.engine.script.JSMethodRunner.runScript (JSMethodRunn=
er.java:79)<BR>&nbsp;at =
org.eclipse.birt.report.engine.script.internal.DtEScriptExec utor.handleJS=
(DtEScriptExecutor.java:71)<BR>&nbsp;... 61 more<BR>Caused by: =
org.eclipse.birt.core.exception.CoreException: Error evaluating =
Javascript expression. Script engine error: TypeError: getList is not a =
function. (DataSet[Scripted Data Set].__bm_OPEN#4)<BR> Script source: =
DataSet[Scripted Data Set].__bm_OPEN, line: 1, =
text:<BR>__bm_OPEN()<BR>&nbsp;at =
org.eclipse.birt.core.script.JavascriptEvalUtil.wrapRhinoExc eption(Javasc=
riptEvalUtil.java:281)<BR>&nbsp;at =
org.eclipse.birt.core.script.JavascriptEvalUtil.evaluateRawS cript(Javascr=
iptEvalUtil.java:105)<BR>&nbsp;at =
org.eclipse.birt.core.script.JavascriptEvalUtil.evaluateScri pt(Javascript=
EvalUtil.java:137)<BR>&nbsp;at =
org.eclipse.birt.data.engine.script.ScriptEvalUtil.evaluateJ SAsExpr(Scrip=
tEvalUtil.java:548)<BR>&nbsp;... 63 more<BR>Caused by: =
org.mozilla.javascript.EcmaError: TypeError: getList is not a function. =
(DataSet[Scripted Data Set].__bm_OPEN#4)<BR>&nbsp;at =
org.mozilla.javascript.ScriptRuntime.constructError(ScriptRu ntime.java:32=
40)<BR>&nbsp;at =
org.mozilla.javascript.ScriptRuntime.constructError(ScriptRu ntime.java:32=
30)<BR>&nbsp;at =
org.mozilla.javascript.ScriptRuntime.typeError(ScriptRuntime .java:3246) <B=
R>&nbsp;at =
org.mozilla.javascript.ScriptRuntime.typeError1(ScriptRuntim e.java:3258) <=
BR>&nbsp;at =
org.mozilla.javascript.ScriptRuntime.notFunctionError(Script Runtime.java:=
3317)<BR>&nbsp;at =
org.mozilla.javascript.ScriptRuntime.getPropFunctionAndThis( ScriptRuntime=
..java:1987)<BR>&nbsp;at =
org.mozilla.javascript.optimizer.OptRuntime.callProp0(OptRun time.java:114=
)<BR>&nbsp;at org.mozilla.javascript.gen.c6._c1(DataSet[Scripted Data =
Set].__bm_OPEN:4)<BR>&nbsp;at =
org.mozilla.javascript.gen.c6.call(DataSet[Scripted Data =
Set].__bm_OPEN)<BR>&nbsp;at =
org.mozilla.javascript.optimizer.OptRuntime.callName0(OptRun time.java:105=
)<BR>&nbsp;at org.mozilla.javascript.gen.c5._c0(DataSource[Scripted Data =
Source].__bm_OPEN:1)<BR>&nbsp;at =
org.mozilla.javascript.gen.c5.call(DataSource[Scripted Data =
Source].__bm_OPEN)<BR>&nbsp;at =
org.mozilla.javascript.ContextFactory.doTopCall(ContextFacto ry.java:304) <=
BR>&nbsp;at =
org.mozilla.javascript.ScriptRuntime.doTopCall(ScriptRuntime .java:2769) <B=
R>&nbsp;at org.mozilla.javascript.gen.c5.call(DataSource[Scripted Data =
Source].__bm_OPEN)<BR>&nbsp;at =
org.mozilla.javascript.gen.c5.exec(DataSource[Scripted Data =
Source].__bm_OPEN)<BR>&nbsp;at =
org.eclipse.birt.core.script.JavascriptEvalUtil.evaluateRawS cript(Javascr=
iptEvalUtil.java:98)<BR>&nbsp;... 65 =
more<BR><BR></PRE></DIV></DIV></PRE></BLOCKQUOTE>
<DIV dir=3Dltr><FONT face=3DArial color=3D#0000ff size=3D2>I am working =
on an RCP=20
project.&nbsp; The report file and the java object in question are in =
the same=20
plug-in project.&nbsp; I am using the RE API (Report Engine API) to =
produce my=20
report in an SWT Browser widget.&nbsp; I can successfully run a report =
that has=20
no data set created.&nbsp; </FONT></DIV>
<DIV dir=3Dltr><FONT face=3DArial color=3D#0000ff =
size=3D2></FONT>&nbsp;</DIV>
<DIV dir=3Dltr><FONT face=3DArial color=3D#0000ff size=3D2>I think my =
problem is a=20
complete lack of knowledge of JavaScript.&nbsp; I have no idea where to =
start=20
debugging the script methods.</FONT></DIV>
<DIV dir=3Dltr><FONT face=3DArial color=3D#0000ff =
size=3D2></FONT>&nbsp;</DIV>
<DIV dir=3Dltr><FONT face=3DArial color=3D#0000ff size=3D2>Help me Jason =
Weathersby,=20
you're my only hope.&nbsp; I am on a tight deadline, and this is the =
last big=20
feature to implement&nbsp;before my RCP application has to =
ship.</FONT></DIV>
<DIV dir=3Dltr><FONT face=3DArial color=3D#0000ff =
size=3D2></FONT>&nbsp;</DIV>
<DIV dir=3Dltr><FONT face=3DArial color=3D#0000ff =
size=3D2>Thanks,</FONT></DIV>
<DIV dir=3Dltr><FONT face=3DArial color=3D#0000ff size=3D2>Trace =
Windham</FONT></DIV>
<DIV dir=3Dltr><FONT face=3DArial color=3D#0000ff =
size=3D2></FONT>&nbsp;</DIV>
<DIV dir=3Dltr><FONT face=3DArial color=3D#0000ff size=3D2>PS... See you =
at Eclipse Con=20
2007</FONT></DIV></BODY></HTML>

------=_NextPart_000_00E6_01C7195A.FD547470--
Re: Using Java Objects access a Data Source [message #205336 is a reply to message #205189] Thu, 07 December 2006 15:39 Go to previous messageGo to next message
Jason Weathersby is currently offline Jason WeathersbyFriend
Messages: 9167
Registered: July 2009
Senior Member

This is a multi-part message in MIME format.

------=_NextPart_000_0037_01C719EB.F3D2B5B0
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

Trace,

You have no getList method in your java code.

Either add one to the TestDataSource or try
changing this code in the =
openimportPackage(Packages.com.hmamg.quote);var myList =3D =
Packages.com.hmamg.quote.TestDataSource.getList();var iter =3D =
myList.getIterator();toimportPackage(Packages.com.hmamg.quot e);var iter =
=3D Packages.com.hmamg.quote.TestDataSource.getListIterator();Ja son =
"Trace Windham" <twindham@ugaais.com> wrote in message =
news:el7ja3$o76$1@utils.eclipse.org...Hello all,

I'm trying to implement the "Tutorial #2: Creating a Scripted Data =
Source" that is layed out in the book Integrating and Extending Birt on =
page 133.

Everything works great until I try to implement the section called =
"Using Java Objects to Access a Data Source".

I have a class called TestDataSource.java

package com.hmamg.quote;import java.util.ArrayList;import =
java.util.Iterator;public class TestDataSource { public static Iterator =
getListIterator() { ArrayList retval =3D new ArrayList(); =
retval.add(new SomeDataObject(33, "First Item")); retval.add(new =
SomeDataObject(54, "Second Item")); return retval.iterator(); } static =
class SomeDataObject { public SomeDataObject(int rate, String name) { =
this.rate =3D rate; this.name =3D name; } private int rate; =
private String name; public String getName() { return name; } =
public void setName(String name) { this.name =3D name; } public int =
getRate() { return rate; } public void setRate(int rate) { =
this.rate =3D rate; } }}I try to access this class in my script method =
called open() on the Scripted Data Set that I created earlier in the =
tutorial

importPackage(Packages.com.hmamg.quote);var myList =3D =
Packages.com.hmamg.quote.TestDataSource.getList();var iter =3D =
myList.getIterator();And here's the script called fetch()

if(iter.hasNext() =3D=3D false){return false;}var node =3D =
iter.next();row[1] =3D node.getRate();row[2] =3D node.getName();return =
true;

I have defined the two columns in the report, and I am trying to show =
them in a table just like I did in the earlier parts of Tutorial Two.

And this is from the stack trace that the report throws when trying to =
run it.

The following items have errors: Table (id =3D 6): - There are errors =
evaluating script "importPackage(Packages.com.hmamg.quote);var myList =
=3D Packages.com.hmamg.quote.TestDataSource.getList();var iter =3D =
myList.getIterator();". Error.ScriptEvaluationError ( 1 time(s) )
detail : org.eclipse.birt.report.engine.api.EngineException: There are =
errors evaluating script "importPackage(Packages.com.hmamg.quote);var =
myList =3D Packages.com.hmamg.quote.TestDataSource.getList();var iter =
=3D myList.getIterator();recordCount =3D 0;". at =
org.eclipse.birt.report.engine.script.internal.DtEScriptExec utor.handleJS=
(DtEScriptExecutor.java:76) at =
org.eclipse.birt.report.engine.script.internal.DataSetScript Executor.hand=
leJS(DataSetScriptExecutor.java:159) at =
org.eclipse.birt.report.engine.script.internal.ScriptDataSet ScriptExecuto=
r.handleOpen(ScriptDataSetScriptExecutor.java:66) at =
org.eclipse.birt.data.engine.impl.ScriptDataSetRuntime.open( ScriptDataSet=
Runtime.java:68) at =
org.eclipse.birt.data.engine.impl.PreparedScriptDSQuery$Scri ptDSQueryExec=
utor$CustomDataSet.open(PreparedScriptDSQuery.java:233) at =
org.eclipse.birt.data.engine.impl.PreparedScriptDSQuery$Scri ptDSQueryExec=
utor.executeOdiQuery(PreparedScriptDSQuery.java:209) at =
org.eclipse.birt.data.engine.impl.QueryExecutor.execute(Quer yExecutor.jav=
a:735) at =
org.eclipse.birt.data.engine.impl.ServiceForQueryResults.exe cuteQuery(Ser=
viceForQueryResults.java:181) at =
org.eclipse.birt.data.engine.impl.QueryResults.getResultIter ator(QueryRes=
ults.java:137) at =
org.eclipse.birt.report.engine.data.dte.DteResultSet.<init>(DteResultSet.=
java:86) at =
org.eclipse.birt.report.engine.data.dte.DteDataEngine.doExec uteQuery(DteD=
ataEngine.java:115) at =
org.eclipse.birt.report.engine.data.dte.AbstractDataEngine.e xecute(Abstra=
ctDataEngine.java:208) at =
org.eclipse.birt.report.engine.executor.ExecutionContext.exe cuteQuery(Exe=
cutionContext.java:1640) at =
org.eclipse.birt.report.engine.executor.QueryItemExecutor.ex ecuteQuery(Qu=
eryItemExecutor.java:62) at =
org.eclipse.birt.report.engine.executor.TableItemExecutor.ex ecute(TableIt=
emExecutor.java:74) at =
org.eclipse.birt.report.engine.internal.executor.l18n.Locali zedReportItem=
Executor.execute(LocalizedReportItemExecutor.java:35) at =
org.eclipse.birt.report.engine.layout.html.HTMLPageLM.layout Children(HTML=
PageLM.java:123) at =
org.eclipse.birt.report.engine.layout.html.HTMLPageLM.layout (HTMLPageLM.j=
ava:81) at =
org.eclipse.birt.report.engine.layout.html.HTMLReportLayoutE ngine.layout(=
HTMLReportLayoutEngine.java:80) at =
org.eclipse.birt.report.engine.api.impl.RunAndRenderTask.run (RunAndRender=
Task.java:194) at =
com.hmamg.reporting.ReportRunner.runReport(ReportRunner.java :163) at =
com.hmamg.reporting.ReportRunner.runHTMLReport(ReportRunner. java:119) at =
com.hmamg.quote.mediators.QuotePreviewMediator.runReport(Quo tePreviewMedi=
ator.java:173) at =
com.hmamg.quote.mediators.QuotePreviewMediator.access$0(Quot ePreviewMedia=
tor.java:169) at =
com.hmamg.quote.mediators.QuotePreviewMediator$1.run(QuotePr eviewMediator=
..java:72) at =
org.eclipse.swt.custom.BusyIndicator.showWhile(BusyIndicator .java:67) at =
com.hmamg.quote.mediators.QuotePreviewMediator.calculate(Quo tePreviewMedi=
ator.java:75) at =
com.hmamg.quote.mediators.QuotePreviewMediator.focusGained(Q uotePreviewMe=
diator.java:219) at =
com.hmamg.quote.components.QuoteTabComposite.updateFocus(Quo teTabComposit=
e.java:97) at =
com.hmamg.quote.components.QuoteTabComposite.access$0(QuoteT abComposite.j=
ava:82) at =
com.hmamg.quote.components.QuoteTabComposite$1.widgetSelecte d(QuoteTabCom=
posite.java:77) at =
org.eclipse.swt.widgets.TypedListener.handleEvent(TypedListe ner.java:90) =
at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java :66) at =
org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:928) at =
org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:952) at =
org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:937) at =
org.eclipse.swt.widgets.Widget.notifyListeners(Widget.java:7 09) at =
org.eclipse.swt.custom.CTabFolder.setSelection(CTabFolder.ja va:3171) at =
org.eclipse.swt.custom.CTabFolder.onMouse(CTabFolder.java:19 53) at =
org.eclipse.swt.custom.CTabFolder$1.handleEvent(CTabFolder.j ava:288) at =
org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java :66) at =
org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:928) at =
org.eclipse.swt.widgets.Display.runDeferredEvents(Display.ja va:3348) at =
org.eclipse.swt.widgets.Display.readAndDispatch(Display.java :2968) at =
org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.jav a:1914) at =
org.eclipse.ui.internal.Workbench.runUI(Workbench.java:1878) at =
org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Work bench.java:41=
9) at =
org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.j ava:149) at =
com.hmamg.application.welcome.Application.run(Application.ja va:105) at =
org.eclipse.core.internal.runtime.PlatformActivator$1.run(Pl atformActivat=
or.java:78) at =
org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher .runApplicati=
on(EclipseAppLauncher.java:92) at =
org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher .start(Eclips=
eAppLauncher.java:68) at =
org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseS tarter.java:4=
00) at =
org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseS tarter.java:1=
77) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at =
sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at =
sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at =
java.lang.reflect.Method.invoke(Unknown Source) at =
org.eclipse.core.launcher.Main.invokeFramework(Main.java:336 ) at =
org.eclipse.core.launcher.Main.basicRun(Main.java:280) at =
org.eclipse.core.launcher.Main.run(Main.java:977) at =
org.eclipse.core.launcher.Main.main(Main.java:952)Caused by: =
org.eclipse.birt.data.engine.core.DataException: A BIRT exception =
occurred: Error evaluating Javascript expression. Script engine error: =
TypeError: getList is not a function. (DataSet[Scripted Data =
Set].__bm_OPEN#4) Script source: DataSet[Scripted Data Set].__bm_OPEN, =
line: 1, text:__bm_OPEN(). See next exception for more information.Error =
evaluating Javascript expression. Script engine error: TypeError: =
getList is not a function. (DataSet[Scripted Data Set].__bm_OPEN#4) =
Script source: DataSet[Scripted Data Set].__bm_OPEN, line: 1, =
text:__bm_OPEN() at =
org.eclipse.birt.data.engine.core.DataException.wrap(DataExc eption.java:1=
18) at =
org.eclipse.birt.data.engine.script.ScriptEvalUtil.evaluateJ SAsExpr(Scrip=
tEvalUtil.java:552) at =
org.eclipse.birt.data.engine.script.JSMethodRunner.runScript (JSMethodRunn=
er.java:79) at =
org.eclipse.birt.report.engine.script.internal.DtEScriptExec utor.handleJS=
(DtEScriptExecutor.java:71) ... 61 moreCaused by: =
org.eclipse.birt.core.exception.CoreException: Error evaluating =
Javascript expression. Script engine error: TypeError: getList is not a =
function. (DataSet[Scripted Data Set].__bm_OPEN#4) Script source: =
DataSet[Scripted Data Set].__bm_OPEN, line: 1, text:__bm_OPEN() at =
org.eclipse.birt.core.script.JavascriptEvalUtil.wrapRhinoExc eption(Javasc=
riptEvalUtil.java:281) at =
org.eclipse.birt.core.script.JavascriptEvalUtil.evaluateRawS cript(Javascr=
iptEvalUtil.java:105) at =
org.eclipse.birt.core.script.JavascriptEvalUtil.evaluateScri pt(Javascript=
EvalUtil.java:137) at =
org.eclipse.birt.data.engine.script.ScriptEvalUtil.evaluateJ SAsExpr(Scrip=
tEvalUtil.java:548) ... 63 moreCaused by: =
org.mozilla.javascript.EcmaError: TypeError: getList is not a function. =
(DataSet[Scripted Data Set].__bm_OPEN#4) at =
org.mozilla.javascript.ScriptRuntime.constructError(ScriptRu ntime.java:32=
40) at =
org.mozilla.javascript.ScriptRuntime.constructError(ScriptRu ntime.java:32=
30) at =
org.mozilla.javascript.ScriptRuntime.typeError(ScriptRuntime .java:3246) =
at =
org.mozilla.javascript.ScriptRuntime.typeError1(ScriptRuntim e.java:3258) =
at =
org.mozilla.javascript.ScriptRuntime.notFunctionError(Script Runtime.java:=
3317) at =
org.mozilla.javascript.ScriptRuntime.getPropFunctionAndThis( ScriptRuntime=
..java:1987) at =
org.mozilla.javascript.optimizer.OptRuntime.callProp0(OptRun time.java:114=
) at org.mozilla.javascript.gen.c6._c1(DataSet[Scripted Data =
Set].__bm_OPEN:4) at org.mozilla.javascript.gen.c6.call(DataSet[Scripted =
Data Set].__bm_OPEN) at =
org.mozilla.javascript.optimizer.OptRuntime.callName0(OptRun time.java:105=
) at org.mozilla.javascript.gen.c5._c0(DataSource[Scripted Data =
Source].__bm_OPEN:1) at =
org.mozilla.javascript.gen.c5.call(DataSource[Scripted Data =
Source].__bm_OPEN) at =
org.mozilla.javascript.ContextFactory.doTopCall(ContextFacto ry.java:304) =
at =
org.mozilla.javascript.ScriptRuntime.doTopCall(ScriptRuntime .java:2769) =
at org.mozilla.javascript.gen.c5.call(DataSource[Scripted Data =
Source].__bm_OPEN) at =
org.mozilla.javascript.gen.c5.exec(DataSource[Scripted Data =
Source].__bm_OPEN) at =
org.eclipse.birt.core.script.JavascriptEvalUtil.evaluateRawS cript(Javascr=
iptEvalUtil.java:98) ... 65 moreI am working on an RCP project. The =
report file and the java object in question are in the same plug-in =
project. I am using the RE API (Report Engine API) to produce my report =
in an SWT Browser widget. I can successfully run a report that has no =
data set created. =20

I think my problem is a complete lack of knowledge of JavaScript. I =
have no idea where to start debugging the script methods.

Help me Jason Weathersby, you're my only hope. I am on a tight =
deadline, and this is the last big feature to implement before my RCP =
application has to ship.

Thanks,
Trace Windham

PS... See you at Eclipse Con 2007
------=_NextPart_000_0037_01C719EB.F3D2B5B0
Content-Type: text/html;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=3DContent-Type content=3D"text/html; =
charset=3Diso-8859-1">
<META content=3D"MSHTML 6.00.2900.2963" name=3DGENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=3D#ffffff>
<DIV><FONT face=3DArial size=3D2>Trace,</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>You have no getList method in your java =

code.</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>Either add one to the TestDataSource or =

try</FONT></DIV>
<DIV><PRE>changing this code in the =
open</PRE><PRE><PRE><PRE>importPackage(Packages.com.hmamg.quote); </PRE><P=
RE>var myList =3D =
Packages.com.hmamg.quote.TestDataSource.getList();</PRE><PRE >var iter =
=3D =
myList.getIterator();</PRE><PRE>&nbsp;</PRE><PRE>to </PRE><PRE>&nbsp;</PRE=
><PRE>&nbsp;</PRE></PRE><PRE>importPackage(Packages.com.hmamg.quote); </PR=
E><PRE>var iter =3D =
Packages.com.hmamg.quote.TestDataSource.getListIterator();</PRE ><PRE>&nbs=
p;</PRE><PRE>Jason </PRE><PRE>&nbsp;</PRE><PRE>"Trace Windham" &lt;<A =
href=3D"mailto:twindham@ugaais.com">twindham@ugaais.com</A>&gt; wrote in =
message <A =
href=3D"news:el7ja3$o76$1@utils.eclipse.org">news:el7ja3$o76$1@utils.ecli=
pse.org</A>...</PRE></PRE></DIV>
<BLOCKQUOTE dir=3Dltr=20
style=3D"PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; =
BORDER-LEFT: #000000 2px solid; MARGIN-RIGHT: 0px">
<DIV><FONT face=3DArial color=3D#0000ff size=3D2>Hello =
all,</FONT></DIV>
<DIV><FONT face=3DArial color=3D#0000ff size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial color=3D#0000ff size=3D2>I'm trying to =
implement the=20
"Tutorial #2: Creating a Scripted Data Source"&nbsp;that is layed out =
in=20
the&nbsp;book <EM><STRONG>Integrating and Extending Birt</STRONG></EM> =
on page=20
133.</FONT></DIV>
<DIV><FONT face=3DArial color=3D#0000ff size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial color=3D#0000ff size=3D2>Everything works =
great until I try=20
to implement the section called "Using Java Objects to Access a Data=20
Source".</FONT></DIV>
<DIV><FONT face=3DArial color=3D#0000ff size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial color=3D#0000ff size=3D2>I have a class called =

TestDataSource.java</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<BLOCKQUOTE dir=3Dltr style=3D"MARGIN-RIGHT: 0px"><PRE>package =
com.hmamg.quote;</PRE><PRE>import java.util.ArrayList;<BR>import =
java.util.Iterator;</PRE><PRE>public class TestDataSource =
{<BR>&nbsp;<BR>&nbsp;public static Iterator getListIterator() =
{<BR>&nbsp;&nbsp;ArrayList retval =3D new =
ArrayList();<BR>&nbsp;&nbsp;retval.add(new SomeDataObject(33, "First =
Item"));<BR>&nbsp;&nbsp;retval.add(new SomeDataObject(54, "Second =
Item"));<BR>&nbsp;&nbsp;return =
retval.iterator();<BR>&nbsp;}<BR>&nbsp;<BR>&nbsp;static class =
SomeDataObject {<BR>&nbsp;&nbsp;public SomeDataObject(int rate, String =
name) {<BR>&nbsp;&nbsp;&nbsp;this.rate =3D =
rate;<BR>&nbsp;&nbsp;&nbsp;this.name =3D =
name;<BR>&nbsp;&nbsp;}</PRE><PRE>&nbsp;&nbsp;private int =
rate;<BR>&nbsp;&nbsp;<BR>&nbsp;&nbsp;private String =
name;</PRE><PRE>&nbsp;&nbsp;public String getName() =
{<BR>&nbsp;&nbsp;&nbsp;return =
name;<BR>&nbsp;&nbsp;}</PRE><PRE>&nbsp;&nbsp;public void setName(String =
name) {<BR>&nbsp;&nbsp;&nbsp;this.name =3D =
name;<BR>&nbsp;&nbsp;}</PRE><PRE>&nbsp;&nbsp;public int getRate() =
{<BR>&nbsp;&nbsp;&nbsp;return =
rate;<BR>&nbsp;&nbsp;}</PRE><PRE>&nbsp;&nbsp;public void setRate(int =
rate) {<BR>&nbsp;&nbsp;&nbsp;this.rate =3D =
rate;<BR>&nbsp;&nbsp;}<BR>&nbsp;}<BR>}<BR ></PRE></BLOCKQUOTE>
<DIV><FONT face=3DArial color=3D#0000ff size=3D2>I try to access this =
class in my=20
script method called <EM>open()</EM> on the Scripted Data Set that I =
created=20
earlier in the tutorial</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<BLOCKQUOTE dir=3Dltr style=3D"MARGIN-RIGHT: =
0px"><PRE>importPackage(Packages.com.hmamg.quote);</PRE><PRE >var myList =
=3D Packages.com.hmamg.quote.TestDataSource.getList();</PRE><PRE >var =
iter =3D myList.getIterator();</PRE></BLOCKQUOTE>
<P dir=3Dltr><FONT face=3DArial size=3D2><FONT color=3D#0000ff>And =
here's the script=20
called <EM>fetch()</EM></FONT></FONT></P>
<BLOCKQUOTE dir=3Dltr style=3D"MARGIN-RIGHT: =
0px"><PRE>if(iter.hasNext() =3D=3D false){</PRE><PRE>return =
false;</PRE><PRE>}</PRE><PRE>var node =3D iter.next();</PRE><PRE>row[1] =
=3D node.getRate();</PRE><PRE>row[2] =3D =
node.getName();</PRE><PRE>return true;</PRE></BLOCKQUOTE>
<P dir=3Dltr><FONT face=3DArial size=3D2><FONT=20
color=3D#0000ff></FONT></FONT>&nbsp;</P>
<P dir=3Dltr><FONT face=3DArial color=3D#0000ff size=3D2>I have =
defined the two=20
columns in the report, and I am trying to show them in a table just =
like I did=20
in the earlier parts of Tutorial Two.</FONT></P>
<P dir=3Dltr><FONT face=3DArial size=3D2><FONT color=3D#0000ff>And =
this is from the=20
stack trace that the report throws when trying to run =
it</FONT>.</FONT></P>
<BLOCKQUOTE dir=3Dltr style=3D"MARGIN-RIGHT: 0px"><PRE =
dir=3Dltr><DIV>The following items have errors: </DIV><BR><DIV><DIV =
id=3Derror_title style=3D"TEXT-DECORATION: underline">Table (id =3D 6): =
</DIV><DIV><SPAN id=3Derror_icon0_0 style=3D"CURSOR: pointer" =
onclick=3D"if (document.getElementById('error_detail0_0').style.display =
=3D=3D 'none') { document.getElementById('error_icon0_0').innerHTML =3D =
'- '; document.getElementById('error_detail0_0').style.display =3D =
'block'; }else { document.getElementById('error_icon0_0').innerHTML =3D =
'+ '; document.getElementById('error_detail0_0').style.display =3D =
'none'; }">- </SPAN>There are errors evaluating script =
"importPackage(Packages.com.hmamg.quote);<BR><BR>var myList =3D =
Packages.com.hmamg.quote.TestDataSource.getList();<BR>var iter =3D =
myList.getIterator();". <PRE id=3Derror_detail0_0 style=3D"DISPLAY: =
block">Error.ScriptEvaluationError ( 1 time(s) )
detail : org.eclipse.birt.report.engine.api.EngineException: There are =
errors evaluating script =
"importPackage(Packages.com.hmamg.quote);<BR><BR>var myList =3D =
Packages.com.hmamg.quote.TestDataSource.getList();<BR>var iter =3D =
myList.getIterator();<BR>recordCount =3D 0;".<BR>&nbsp;at =
org.eclipse.birt.report.engine.script.internal.DtEScriptExec utor.handleJS=
(DtEScriptExecutor.java:76)<BR>&nbsp;at =
org.eclipse.birt.report.engine.script.internal.DataSetScript Executor.hand=
leJS(DataSetScriptExecutor.java:159)<BR>&nbsp;at =
org.eclipse.birt.report.engine.script.internal.ScriptDataSet ScriptExecuto=
r.handleOpen(ScriptDataSetScriptExecutor.java:66)<BR>&nbsp;at =
org.eclipse.birt.data.engine.impl.ScriptDataSetRuntime.open( ScriptDataSet=
Runtime.java:68)<BR>&nbsp;at =
org.eclipse.birt.data.engine.impl.PreparedScriptDSQuery$Scri ptDSQueryExec=
utor$CustomDataSet.open(PreparedScriptDSQuery.java:233)<BR>&nbsp;at =
org.eclipse.birt.data.engine.impl.PreparedScriptDSQuery$Scri ptDSQueryExec=
utor.executeOdiQuery(PreparedScriptDSQuery.java:209)<BR>&nbsp;at =
org.eclipse.birt.data.engine.impl.QueryExecutor.execute(Quer yExecutor.jav=
a:735)<BR>&nbsp;at =
org.eclipse.birt.data.engine.impl.ServiceForQueryResults.exe cuteQuery(Ser=
viceForQueryResults.java:181)<BR>&nbsp;at =
org.eclipse.birt.data.engine.impl.QueryResults.getResultIter ator(QueryRes=
ults.java:137)<BR>&nbsp;at =
org.eclipse.birt.report.engine.data.dte.DteResultSet.&lt ;init&gt;(DteResu=
ltSet.java:86)<BR>&nbsp;at =
org.eclipse.birt.report.engine.data.dte.DteDataEngine.doExec uteQuery(DteD=
ataEngine.java:115)<BR>&nbsp;at =
org.eclipse.birt.report.engine.data.dte.AbstractDataEngine.e xecute(Abstra=
ctDataEngine.java:208)<BR>&nbsp;at =
org.eclipse.birt.report.engine.executor.ExecutionContext.exe cuteQuery(Exe=
cutionContext.java:1640)<BR>&nbsp;at =
org.eclipse.birt.report.engine.executor.QueryItemExecutor.ex ecuteQuery(Qu=
eryItemExecutor.java:62)<BR>&nbsp;at =
org.eclipse.birt.report.engine.executor.TableItemExecutor.ex ecute(TableIt=
emExecutor.java:74)<BR>&nbsp;at =
org.eclipse.birt.report.engine.internal.executor.l18n.Locali zedReportItem=
Executor.execute(LocalizedReportItemExecutor.java:35)<BR>&nbsp;at =
org.eclipse.birt.report.engine.layout.html.HTMLPageLM.layout Children(HTML=
PageLM.java:123)<BR>&nbsp;at =
org.eclipse.birt.report.engine.layout.html.HTMLPageLM.layout (HTMLPageLM.j=
ava:81)<BR>&nbsp;at =
org.eclipse.birt.report.engine.layout.html.HTMLReportLayoutE ngine.layout(=
HTMLReportLayoutEngine.java:80)<BR>&nbsp;at =
org.eclipse.birt.report.engine.api.impl.RunAndRenderTask.run (RunAndRender=
Task.java:194)<BR>&nbsp;at =
com.hmamg.reporting.ReportRunner.runReport(ReportRunner.java :163) <BR>&nbs=
p;at =
com.hmamg.reporting.ReportRunner.runHTMLReport(ReportRunner. java:119) <BR>=
&nbsp;at =
com.hmamg.quote.mediators.QuotePreviewMediator.runReport(Quo tePreviewMedi=
ator.java:173)<BR>&nbsp;at =
com.hmamg.quote.mediators.QuotePreviewMediator.access$0(Quot ePreviewMedia=
tor.java:169)<BR>&nbsp;at =
com.hmamg.quote.mediators.QuotePreviewMediator$1.run(QuotePr eviewMediator=
..java:72)<BR>&nbsp;at =
org.eclipse.swt.custom.BusyIndicator.showWhile(BusyIndicator .java:67) <BR>=
&nbsp;at =
com.hmamg.quote.mediators.QuotePreviewMediator.calculate(Quo tePreviewMedi=
ator.java:75)<BR>&nbsp;at =
com.hmamg.quote.mediators.QuotePreviewMediator.focusGained(Q uotePreviewMe=
diator.java:219)<BR>&nbsp;at =
com.hmamg.quote.components.QuoteTabComposite.updateFocus(Quo teTabComposit=
e.java:97)<BR>&nbsp;at =
com.hmamg.quote.components.QuoteTabComposite.access$0(QuoteT abComposite.j=
ava:82)<BR>&nbsp;at =
com.hmamg.quote.components.QuoteTabComposite$1.widgetSelecte d(QuoteTabCom=
posite.java:77)<BR>&nbsp;at =
org.eclipse.swt.widgets.TypedListener.handleEvent(TypedListe ner.java:90) <=
BR>&nbsp;at =
org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java :66) <BR>&nbsp=
;at =
org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:928)<BR >&nbsp;at =
org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:952)<BR >&nbsp;at =
org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:937)<BR >&nbsp;at =
org.eclipse.swt.widgets.Widget.notifyListeners(Widget.java:7 09) <BR>&nbsp;=
at =
org.eclipse.swt.custom.CTabFolder.setSelection(CTabFolder.ja va:3171) <BR>&=
nbsp;at =
org.eclipse.swt.custom.CTabFolder.onMouse(CTabFolder.java:19 53) <BR>&nbsp;=
at =
org.eclipse.swt.custom.CTabFolder$1.handleEvent(CTabFolder.j ava:288) <BR>&=
nbsp;at =
org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java :66) <BR>&nbsp=
;at =
org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:928)<BR >&nbsp;at =
org.eclipse.swt.widgets.Display.runDeferredEvents(Display.ja va:3348) <BR>&=
nbsp;at =
org.eclipse.swt.widgets.Display.readAndDispatch(Display.java :2968) <BR>&nb=
sp;at =
org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.jav a:1914) <BR>&n=
bsp;at =
org.eclipse.ui.internal.Workbench.runUI(Workbench.java:1878) <BR>&nbsp;at =
org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Work bench.java:41=
9)<BR>&nbsp;at =
org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.j ava:149) <BR>&=
nbsp;at =
com.hmamg.application.welcome.Application.run(Application.ja va:105) <BR>&n=
bsp;at =
org.eclipse.core.internal.runtime.PlatformActivator$1.run(Pl atformActivat=
or.java:78)<BR>&nbsp;at =
org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher .runApplicati=
on(EclipseAppLauncher.java:92)<BR>&nbsp;at =
org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher .start(Eclips=
eAppLauncher.java:68)<BR>&nbsp;at =
org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseS tarter.java:4=
00)<BR>&nbsp;at =
org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseS tarter.java:1=
77)<BR>&nbsp;at sun.reflect.NativeMethodAccessorImpl.invoke0(Native =
Method)<BR>&nbsp;at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown =
Source)<BR>&nbsp;at =
sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown =
Source)<BR>&nbsp;at java.lang.reflect.Method.invoke(Unknown =
Source)<BR>&nbsp;at =
org.eclipse.core.launcher.Main.invokeFramework(Main.java:336 ) <BR>&nbsp;at=
org.eclipse.core.launcher.Main.basicRun(Main.java:280)<BR>&nbsp;at =
org.eclipse.core.launcher.Main.run(Main.java:977)<BR>&nbsp;at =
org.eclipse.core.launcher.Main.main(Main.java:952)<BR>Caused by: =
org.eclipse.birt.data.engine.core.DataException: A BIRT exception =
occurred: Error evaluating Javascript expression. Script engine error: =
TypeError: getList is not a function. (DataSet[Scripted Data =
Set].__bm_OPEN#4)<BR> Script source: DataSet[Scripted Data =
Set].__bm_OPEN, line: 1, text:<BR>__bm_OPEN(). See next exception for =
more information.<BR>Error evaluating Javascript expression. Script =
engine error: TypeError: getList is not a function. (DataSet[Scripted =
Data Set].__bm_OPEN#4)<BR> Script source: DataSet[Scripted Data =
Set].__bm_OPEN, line: 1, text:<BR>__bm_OPEN()<BR>&nbsp;at =
org.eclipse.birt.data.engine.core.DataException.wrap(DataExc eption.java:1=
18)<BR>&nbsp;at =
org.eclipse.birt.data.engine.script.ScriptEvalUtil.evaluateJ SAsExpr(Scrip=
tEvalUtil.java:552)<BR>&nbsp;at =
org.eclipse.birt.data.engine.script.JSMethodRunner.runScript (JSMethodRunn=
er.java:79)<BR>&nbsp;at =
org.eclipse.birt.report.engine.script.internal.DtEScriptExec utor.handleJS=
(DtEScriptExecutor.java:71)<BR>&nbsp;... 61 more<BR>Caused by: =
org.eclipse.birt.core.exception.CoreException: Error evaluating =
Javascript expression. Script engine error: TypeError: getList is not a =
function. (DataSet[Scripted Data Set].__bm_OPEN#4)<BR> Script source: =
DataSet[Scripted Data Set].__bm_OPEN, line: 1, =
text:<BR>__bm_OPEN()<BR>&nbsp;at =
org.eclipse.birt.core.script.JavascriptEvalUtil.wrapRhinoExc eption(Javasc=
riptEvalUtil.java:281)<BR>&nbsp;at =
org.eclipse.birt.core.script.JavascriptEvalUtil.evaluateRawS cript(Javascr=
iptEvalUtil.java:105)<BR>&nbsp;at =
org.eclipse.birt.core.script.JavascriptEvalUtil.evaluateScri pt(Javascript=
EvalUtil.java:137)<BR>&nbsp;at =
org.eclipse.birt.data.engine.script.ScriptEvalUtil.evaluateJ SAsExpr(Scrip=
tEvalUtil.java:548)<BR>&nbsp;... 63 more<BR>Caused by: =
org.mozilla.javascript.EcmaError: TypeError: getList is not a function. =
(DataSet[Scripted Data Set].__bm_OPEN#4)<BR>&nbsp;at =
org.mozilla.javascript.ScriptRuntime.constructError(ScriptRu ntime.java:32=
40)<BR>&nbsp;at =
org.mozilla.javascript.ScriptRuntime.constructError(ScriptRu ntime.java:32=
30)<BR>&nbsp;at =
org.mozilla.javascript.ScriptRuntime.typeError(ScriptRuntime .java:3246) <B=
R>&nbsp;at =
org.mozilla.javascript.ScriptRuntime.typeError1(ScriptRuntim e.java:3258) <=
BR>&nbsp;at =
org.mozilla.javascript.ScriptRuntime.notFunctionError(Script Runtime.java:=
3317)<BR>&nbsp;at =
org.mozilla.javascript.ScriptRuntime.getPropFunctionAndThis( ScriptRuntime=
..java:1987)<BR>&nbsp;at =
org.mozilla.javascript.optimizer.OptRuntime.callProp0(OptRun time.java:114=
)<BR>&nbsp;at org.mozilla.javascript.gen.c6._c1(DataSet[Scripted Data =
Set].__bm_OPEN:4)<BR>&nbsp;at =
org.mozilla.javascript.gen.c6.call(DataSet[Scripted Data =
Set].__bm_OPEN)<BR>&nbsp;at =
org.mozilla.javascript.optimizer.OptRuntime.callName0(OptRun time.java:105=
)<BR>&nbsp;at org.mozilla.javascript.gen.c5._c0(DataSource[Scripted Data =
Source].__bm_OPEN:1)<BR>&nbsp;at =
org.mozilla.javascript.gen.c5.call(DataSource[Scripted Data =
Source].__bm_OPEN)<BR>&nbsp;at =
org.mozilla.javascript.ContextFactory.doTopCall(ContextFacto ry.java:304) <=
BR>&nbsp;at =
org.mozilla.javascript.ScriptRuntime.doTopCall(ScriptRuntime .java:2769) <B=
R>&nbsp;at org.mozilla.javascript.gen.c5.call(DataSource[Scripted Data =
Source].__bm_OPEN)<BR>&nbsp;at =
org.mozilla.javascript.gen.c5.exec(DataSource[Scripted Data =
Source].__bm_OPEN)<BR>&nbsp;at =
org.eclipse.birt.core.script.JavascriptEvalUtil.evaluateRawS cript(Javascr=
iptEvalUtil.java:98)<BR>&nbsp;... 65 =
more<BR><BR></PRE></DIV></DIV></PRE></BLOCKQUOTE>
<DIV dir=3Dltr><FONT face=3DArial color=3D#0000ff size=3D2>I am =
working on an RCP=20
project.&nbsp; The report file and the java object in question are in =
the same=20
plug-in project.&nbsp; I am using the RE API (Report Engine API) to =
produce my=20
report in an SWT Browser widget.&nbsp; I can successfully run a report =
that=20
has no data set created.&nbsp; </FONT></DIV>
<DIV dir=3Dltr><FONT face=3DArial color=3D#0000ff =
size=3D2></FONT>&nbsp;</DIV>
<DIV dir=3Dltr><FONT face=3DArial color=3D#0000ff size=3D2>I think my =
problem is a=20
complete lack of knowledge of JavaScript.&nbsp; I have no idea where =
to start=20
debugging the script methods.</FONT></DIV>
<DIV dir=3Dltr><FONT face=3DArial color=3D#0000ff =
size=3D2></FONT>&nbsp;</DIV>
<DIV dir=3Dltr><FONT face=3DArial color=3D#0000ff size=3D2>Help me =
Jason Weathersby,=20
you're my only hope.&nbsp; I am on a tight deadline, and this is the =
last big=20
feature to implement&nbsp;before my RCP application has to =
ship.</FONT></DIV>
<DIV dir=3Dltr><FONT face=3DArial color=3D#0000ff =
size=3D2></FONT>&nbsp;</DIV>
<DIV dir=3Dltr><FONT face=3DArial color=3D#0000ff =
size=3D2>Thanks,</FONT></DIV>
<DIV dir=3Dltr><FONT face=3DArial color=3D#0000ff size=3D2>Trace =
Windham</FONT></DIV>
<DIV dir=3Dltr><FONT face=3DArial color=3D#0000ff =
size=3D2></FONT>&nbsp;</DIV>
<DIV dir=3Dltr><FONT face=3DArial color=3D#0000ff size=3D2>PS... See =
you at Eclipse=20
Con 2007</FONT></DIV></BLOCKQUOTE></BODY></HTML>

------=_NextPart_000_0037_01C719EB.F3D2B5B0--
Re: Using Java Objects access a Data Source [message #205431 is a reply to message #205336] Thu, 07 December 2006 19:43 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: twindham.ugaais.com

This is a multi-part message in MIME format.

------=_NextPart_000_000A_01C71A05.A8F73380
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

Opps. =20

I had made that correction already, the bug was that I cut and pasted =
the wrong code in this message. With that said, I went back and I tried =
your suggestion. Now the stack trace is exactly the same, except it =
says that the=20

.... getListIterator is not a function instead of... getList is not a =
function.I've tried taking the static identifier off of the method =
getList(), and running this code:
=20
var dataClass =3D new Packages.com.hmamg.quote.TestDataSource();var iter =
=3D dataClass.getListIterator();
And I get the same stack trace as before with only one difference:

.... TestDataSource is not a function;
It looks like the report cannot find the class, TestDataSource.java It =
exists in the same plug in project as the report. =20

Is there a special way the report finds the classpath when the Report =
Engine API is being used instead of the BIRT Web Viewer?

Although I'm not using it yet, could this method below impact my =
problem? Just curious.
IRunAndRenderTask task =3D =
engine.createRunAndRenderTask(design);task.addScriptableJava Object(String=
, Object);Thanks in advance for all your help. =20
Trace =20


"Jason Weathersby" <jweathersby@actuate.com> wrote in message =
news:el9cjb$tst$1@utils.eclipse.org...
Trace,

You have no getList method in your java code.

Either add one to the TestDataSource or try
changing this code in the =
openimportPackage(Packages.com.hmamg.quote);var myList =3D =
Packages.com.hmamg.quote.TestDataSource.getList();var iter =3D =
myList.getIterator(); to importPackage(Packages.com.hmamg.quote);var =
iter =3D Packages.com.hmamg.quote.TestDataSource.getListIterator(); =
Jason "Trace Windham" <twindham@ugaais.com> wrote in message =
news:el7ja3$o76$1@utils.eclipse.org...Hello all,

I'm trying to implement the "Tutorial #2: Creating a Scripted Data =
Source" that is layed out in the book Integrating and Extending Birt on =
page 133.

Everything works great until I try to implement the section called =
"Using Java Objects to Access a Data Source".

I have a class called TestDataSource.java

package com.hmamg.quote;import java.util.ArrayList;import =
java.util.Iterator;public class TestDataSource { public static Iterator =
getListIterator() { ArrayList retval =3D new ArrayList(); =
retval.add(new SomeDataObject(33, "First Item")); retval.add(new =
SomeDataObject(54, "Second Item")); return retval.iterator(); } static =
class SomeDataObject { public SomeDataObject(int rate, String name) { =
this.rate =3D rate; this.name =3D name; } private int rate; =
private String name; public String getName() { return name; } =
public void setName(String name) { this.name =3D name; } public int =
getRate() { return rate; } public void setRate(int rate) { =
this.rate =3D rate; } }}I try to access this class in my script method =
called open() on the Scripted Data Set that I created earlier in the =
tutorial

importPackage(Packages.com.hmamg.quote);var myList =3D =
Packages.com.hmamg.quote.TestDataSource.getList();var iter =3D =
myList.getIterator();And here's the script called fetch()

if(iter.hasNext() =3D=3D false){return false;}var node =3D =
iter.next();row[1] =3D node.getRate();row[2] =3D node.getName();return =
true;

I have defined the two columns in the report, and I am trying to =
show them in a table just like I did in the earlier parts of Tutorial =
Two.

And this is from the stack trace that the report throws when trying =
to run it.

The following items have errors: Table (id =3D 6): - There are errors =
evaluating script "importPackage(Packages.com.hmamg.quote);var myList =
=3D Packages.com.hmamg.quote.TestDataSource.getList();var iter =3D =
myList.getIterator();". Error.ScriptEvaluationError ( 1 time(s) )
detail : org.eclipse.birt.report.engine.api.EngineException: There are =
errors evaluating script "importPackage(Packages.com.hmamg.quote);var =
myList =3D Packages.com.hmamg.quote.TestDataSource.getList();var iter =
=3D myList.getIterator();recordCount =3D 0;". at =
org.eclipse.birt.report.engine.script.internal.DtEScriptExec utor.handleJS=
(DtEScriptExecutor.java:76) at =
org.eclipse.birt.report.engine.script.internal.DataSetScript Executor.hand=
leJS(DataSetScriptExecutor.java:159) at =
org.eclipse.birt.report.engine.script.internal.ScriptDataSet ScriptExecuto=
r.handleOpen(ScriptDataSetScriptExecutor.java:66) at =
org.eclipse.birt.data.engine.impl.ScriptDataSetRuntime.open( ScriptDataSet=
Runtime.java:68) at =
org.eclipse.birt.data.engine.impl.PreparedScriptDSQuery$Scri ptDSQueryExec=
utor$CustomDataSet.open(PreparedScriptDSQuery.java:233) at =
org.eclipse.birt.data.engine.impl.PreparedScriptDSQuery$Scri ptDSQueryExec=
utor.executeOdiQuery(PreparedScriptDSQuery.java:209) at =
org.eclipse.birt.data.engine.impl.QueryExecutor.execute(Quer yExecutor.jav=
a:735) at =
org.eclipse.birt.data.engine.impl.ServiceForQueryResults.exe cuteQuery(Ser=
viceForQueryResults.java:181) at =
org.eclipse.birt.data.engine.impl.QueryResults.getResultIter ator(QueryRes=
ults.java:137) at =
org.eclipse.birt.report.engine.data.dte.DteResultSet.<init>(DteResultSet.=
java:86) at =
org.eclipse.birt.report.engine.data.dte.DteDataEngine.doExec uteQuery(DteD=
ataEngine.java:115) at =
org.eclipse.birt.report.engine.data.dte.AbstractDataEngine.e xecute(Abstra=
ctDataEngine.java:208) at =
org.eclipse.birt.report.engine.executor.ExecutionContext.exe cuteQuery(Exe=
cutionContext.java:1640) at =
org.eclipse.birt.report.engine.executor.QueryItemExecutor.ex ecuteQuery(Qu=
eryItemExecutor.java:62) at =
org.eclipse.birt.report.engine.executor.TableItemExecutor.ex ecute(TableIt=
emExecutor.java:74) at =
org.eclipse.birt.report.engine.internal.executor.l18n.Locali zedReportItem=
Executor.execute(LocalizedReportItemExecutor.java:35) at =
org.eclipse.birt.report.engine.layout.html.HTMLPageLM.layout Children(HTML=
PageLM.java:123) at =
org.eclipse.birt.report.engine.layout.html.HTMLPageLM.layout (HTMLPageLM.j=
ava:81) at =
org.eclipse.birt.report.engine.layout.html.HTMLReportLayoutE ngine.layout(=
HTMLReportLayoutEngine.java:80) at =
org.eclipse.birt.report.engine.api.impl.RunAndRenderTask.run (RunAndRender=
Task.java:194) at =
com.hmamg.reporting.ReportRunner.runReport(ReportRunner.java :163) at =
com.hmamg.reporting.ReportRunner.runHTMLReport(ReportRunner. java:119) at =
com.hmamg.quote.mediators.QuotePreviewMediator.runReport(Quo tePreviewMedi=
ator.java:173) at =
com.hmamg.quote.mediators.QuotePreviewMediator.access$0(Quot ePreviewMedia=
tor.java:169) at =
com.hmamg.quote.mediators.QuotePreviewMediator$1.run(QuotePr eviewMediator=
..java:72) at =
org.eclipse.swt.custom.BusyIndicator.showWhile(BusyIndicator .java:67) at =
com.hmamg.quote.mediators.QuotePreviewMediator.calculate(Quo tePreviewMedi=
ator.java:75) at =
com.hmamg.quote.mediators.QuotePreviewMediator.focusGained(Q uotePreviewMe=
diator.java:219) at =
com.hmamg.quote.components.QuoteTabComposite.updateFocus(Quo teTabComposit=
e.java:97) at =
com.hmamg.quote.components.QuoteTabComposite.access$0(QuoteT abComposite.j=
ava:82) at =
com.hmamg.quote.components.QuoteTabComposite$1.widgetSelecte d(QuoteTabCom=
posite.java:77) at =
org.eclipse.swt.widgets.TypedListener.handleEvent(TypedListe ner.java:90) =
at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java :66) at =
org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:928) at =
org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:952) at =
org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:937) at =
org.eclipse.swt.widgets.Widget.notifyListeners(Widget.java:7 09) at =
org.eclipse.swt.custom.CTabFolder.setSelection(CTabFolder.ja va:3171) at =
org.eclipse.swt.custom.CTabFolder.onMouse(CTabFolder.java:19 53) at =
org.eclipse.swt.custom.CTabFolder$1.handleEvent(CTabFolder.j ava:288) at =
org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java :66) at =
org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:928) at =
org.eclipse.swt.widgets.Display.runDeferredEvents(Display.ja va:3348) at =
org.eclipse.swt.widgets.Display.readAndDispatch(Display.java :2968) at =
org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.jav a:1914) at =
org.eclipse.ui.internal.Workbench.runUI(Workbench.java:1878) at =
org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Work bench.java:41=
9) at =
org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.j ava:149) at =
com.hmamg.application.welcome.Application.run(Application.ja va:105) at =
org.eclipse.core.internal.runtime.PlatformActivator$1.run(Pl atformActivat=
or.java:78) at =
org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher .runApplicati=
on(EclipseAppLauncher.java:92) at =
org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher .start(Eclips=
eAppLauncher.java:68) at =
org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseS tarter.java:4=
00) at =
org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseS tarter.java:1=
77) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at =
sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at =
sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at =
java.lang.reflect.Method.invoke(Unknown Source) at =
org.eclipse.core.launcher.Main.invokeFramework(Main.java:336 ) at =
org.eclipse.core.launcher.Main.basicRun(Main.java:280) at =
org.eclipse.core.launcher.Main.run(Main.java:977) at =
org.eclipse.core.launcher.Main.main(Main.java:952)Caused by: =
org.eclipse.birt.data.engine.core.DataException: A BIRT exception =
occurred: Error evaluating Javascript expression. Script engine error: =
TypeError: getList is not a function. (DataSet[Scripted Data =
Set].__bm_OPEN#4) Script source: DataSet[Scripted Data Set].__bm_OPEN, =
line: 1, text:__bm_OPEN(). See next exception for more information.Error =
evaluating Javascript expression. Script engine error: TypeError: =
getList is not a function. (DataSet[Scripted Data Set].__bm_OPEN#4) =
Script source: DataSet[Scripted Data Set].__bm_OPEN, line: 1, =
text:__bm_OPEN() at =
org.eclipse.birt.data.engine.core.DataException.wrap(DataExc eption.java:1=
18) at =
org.eclipse.birt.data.engine.script.ScriptEvalUtil.evaluateJ SAsExpr(Scrip=
tEvalUtil.java:552) at =
org.eclipse.birt.data.engine.script.JSMethodRunner.runScript (JSMethodRunn=
er.java:79) at =
org.eclipse.birt.report.engine.script.internal.DtEScriptExec utor.handleJS=
(DtEScriptExecutor.java:71) ... 61 moreCaused by: =
org.eclipse.birt.core.exception.CoreException: Error evaluating =
Javascript expression. Script engine error: TypeError: getList is not a =
function. (DataSet[Scripted Data Set].__bm_OPEN#4) Script source: =
DataSet[Scripted Data Set].__bm_OPEN, line: 1, text:__bm_OPEN() at =
org.eclipse.birt.core.script.JavascriptEvalUtil.wrapRhinoExc eption(Javasc=
riptEvalUtil.java:281) at =
org.eclipse.birt.core.script.JavascriptEvalUtil.evaluateRawS cript(Javascr=
iptEvalUtil.java:105) at =
org.eclipse.birt.core.script.JavascriptEvalUtil.evaluateScri pt(Javascript=
EvalUtil.java:137) at =
org.eclipse.birt.data.engine.script.ScriptEvalUtil.evaluateJ SAsExpr(Scrip=
tEvalUtil.java:548) ... 63 moreCaused by: =
org.mozilla.javascript.EcmaError: TypeError: getList is not a function. =
(DataSet[Scripted Data Set].__bm_OPEN#4) at =
org.mozilla.javascript.ScriptRuntime.constructError(ScriptRu ntime.java:32=
40) at =
org.mozilla.javascript.ScriptRuntime.constructError(ScriptRu ntime.java:32=
30) at =
org.mozilla.javascript.ScriptRuntime.typeError(ScriptRuntime .java:3246) =
at =
org.mozilla.javascript.ScriptRuntime.typeError1(ScriptRuntim e.java:3258) =
at =
org.mozilla.javascript.ScriptRuntime.notFunctionError(Script Runtime.java:=
3317) at =
org.mozilla.javascript.ScriptRuntime.getPropFunctionAndThis( ScriptRuntime=
..java:1987) at =
org.mozilla.javascript.optimizer.OptRuntime.callProp0(OptRun time.java:114=
) at org.mozilla.javascript.gen.c6._c1(DataSet[Scripted Data =
Set].__bm_OPEN:4) at org.mozilla.javascript.gen.c6.call(DataSet[Scripted =
Data Set].__bm_OPEN) at =
org.mozilla.javascript.optimizer.OptRuntime.callName0(OptRun time.java:105=
) at org.mozilla.javascript.gen.c5._c0(DataSource[Scripted Data =
Source].__bm_OPEN:1) at =
org.mozilla.javascript.gen.c5.call(DataSource[Scripted Data =
Source].__bm_OPEN) at =
org.mozilla.javascript.ContextFactory.doTopCall(ContextFacto ry.java:304) =
at =
org.mozilla.javascript.ScriptRuntime.doTopCall(ScriptRuntime .java:2769) =
at org.mozilla.javascript.gen.c5.call(DataSource[Scripted Data =
Source].__bm_OPEN) at =
org.mozilla.javascript.gen.c5.exec(DataSource[Scripted Data =
Source].__bm_OPEN) at =
org.eclipse.birt.core.script.JavascriptEvalUtil.evaluateRawS cript(Javascr=
iptEvalUtil.java:98) ... 65 moreI am working on an RCP project. The =
report file and the java object in question are in the same plug-in =
project. I am using the RE API (Report Engine API) to produce my report =
in an SWT Browser widget. I can successfully run a report that has no =
data set created. =20

I think my problem is a complete lack of knowledge of JavaScript. I =
have no idea where to start debugging the script methods.

Help me Jason Weathersby, you're my only hope. I am on a tight =
deadline, and this is the last big feature to implement before my RCP =
application has to ship.

Thanks,
Trace Windham

PS... See you at Eclipse Con 2007
------=_NextPart_000_000A_01C71A05.A8F73380
Content-Type: text/html;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=3DContent-Type content=3D"text/html; =
charset=3Diso-8859-1">
<META content=3D"MSHTML 6.00.2900.2912" name=3DGENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=3D#ffffff>
<DIV><FONT face=3DArial size=3D2>Opps.&nbsp; </FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>I had made that correction already, the =
bug was=20
that I cut and pasted the wrong code in this message.&nbsp; With that =
said, I=20
went back and I tried your suggestion.&nbsp; Now the stack trace is =
exactly the=20
same, except it says that the </FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<BLOCKQUOTE dir=3Dltr style=3D"MARGIN-RIGHT: 0px"><PRE>... =
getListIterator is not a function </PRE><PRE>instead of</PRE><PRE>... =
getList is not a function.</PRE></BLOCKQUOTE>
<DIV dir=3Dltr><FONT face=3DArial size=3D2>I've tried taking the static =
identifier off=20
of the method getList(), and&nbsp;running this code:</FONT></DIV>
<DIV dir=3Dltr>&nbsp;&nbsp;&nbsp;</DIV>
<BLOCKQUOTE dir=3Dltr style=3D"MARGIN-RIGHT: 0px"><PRE dir=3Dltr>var =
dataClass =3D new Packages.com.hmamg.quote.TestDataSource();</PRE><PRE =
dir=3Dltr>var iter =3D dataClass.getListIterator();</PRE></BLOCKQUOTE>
<DIV dir=3Dltr><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV dir=3Dltr><FONT face=3DArial size=3D2>And I get the same stack =
trace as before=20
with only one difference:</FONT></DIV>
<DIV dir=3Dltr><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<BLOCKQUOTE dir=3Dltr style=3D"MARGIN-RIGHT: 0px"><PRE dir=3Dltr>... =
TestDataSource is not a function;</PRE></BLOCKQUOTE>
<DIV dir=3Dltr><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV dir=3Dltr><FONT face=3DArial size=3D2>It looks like the report =
cannot find the=20
class, TestDataSource.java&nbsp; It exists in the same plug in project =
as the=20
report.&nbsp; </FONT></DIV>
<DIV dir=3Dltr><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV dir=3Dltr><FONT face=3DArial size=3D2>Is there a special way the =
report finds the=20
classpath when&nbsp;the Report Engine API is being used instead of the =
BIRT Web=20
Viewer?</FONT></DIV>
<DIV dir=3Dltr><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV dir=3Dltr><FONT face=3DArial size=3D2>Although I'm not using it =
yet, could this=20
method below</FONT><FONT face=3DArial size=3D2>&nbsp;impact my =
problem?&nbsp; Just=20
curious.</FONT></DIV>
<BLOCKQUOTE dir=3Dltr style=3D"MARGIN-RIGHT: 0px"><PRE =
dir=3Dltr>IRunAndRenderTask task =3D =
engine.createRunAndRenderTask(design);</PRE><PRE>task.addScriptableJavaOb=
ject(String, Object);</PRE></BLOCKQUOTE>
<DIV dir=3Dltr><FONT face=3DArial size=3D2>Thanks in advance for all =
your help.&nbsp;=20
</FONT></DIV>
<DIV dir=3Dltr><FONT face=3DArial size=3D2>Trace </FONT>&nbsp;</DIV>
<DIV dir=3Dltr><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV dir=3Dltr><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<BLOCKQUOTE dir=3Dltr=20
style=3D"PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; =
BORDER-LEFT: #000000 2px solid; MARGIN-RIGHT: 0px">
<DIV>"Jason Weathersby" &lt;<A=20
=
href=3D"mailto:jweathersby@actuate.com">jweathersby@actuate.com</A>&gt; =
wrote in=20
message <A=20
=
href=3D"news:el9cjb$tst$1@utils.eclipse.org">news:el9cjb$tst$1@utils.ecli=
pse.org</A>...</DIV>
<DIV><FONT face=3DArial size=3D2>Trace,</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>You have no getList method in your =
java=20
code.</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>Either add one to the TestDataSource =
or=20
try</FONT></DIV>
<DIV><PRE>changing this code in the =
open</PRE><PRE><PRE><PRE>importPackage(Packages.com.hmamg.quote); </PRE><P=
RE>var myList =3D =
Packages.com.hmamg.quote.TestDataSource.getList();</PRE><PRE >var iter =
=3D =
myList.getIterator();</PRE><PRE>&nbsp;</PRE><PRE>to </PRE><PRE>&nbsp;</PRE=
><PRE>&nbsp;</PRE></PRE><PRE>importPackage(Packages.com.hmamg.quote); </PR=
E><PRE>var iter =3D =
Packages.com.hmamg.quote.TestDataSource.getListIterator();</PRE ><PRE>&nbs=
p;</PRE><PRE>Jason </PRE><PRE>&nbsp;</PRE><PRE>"Trace Windham" &lt;<A =
href=3D"mailto:twindham@ugaais.com">twindham@ugaais.com</A>&gt; wrote in =
message <A =
href=3D"news:el7ja3$o76$1@utils.eclipse.org">news:el7ja3$o76$1@utils.ecli=
pse.org</A>...</PRE></PRE></DIV>
<BLOCKQUOTE dir=3Dltr=20
style=3D"PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; =
BORDER-LEFT: #000000 2px solid; MARGIN-RIGHT: 0px">
<DIV><FONT face=3DArial color=3D#0000ff size=3D2>Hello =
all,</FONT></DIV>
<DIV><FONT face=3DArial color=3D#0000ff size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial color=3D#0000ff size=3D2>I'm trying to =
implement the=20
"Tutorial #2: Creating a Scripted Data Source"&nbsp;that is layed =
out in=20
the&nbsp;book <EM><STRONG>Integrating and Extending =
Birt</STRONG></EM> on=20
page 133.</FONT></DIV>
<DIV><FONT face=3DArial color=3D#0000ff size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial color=3D#0000ff size=3D2>Everything works =
great until I=20
try to implement the section called "Using Java Objects to Access a =
Data=20
Source".</FONT></DIV>
<DIV><FONT face=3DArial color=3D#0000ff size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial color=3D#0000ff size=3D2>I have a class =
called=20
TestDataSource.java</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<BLOCKQUOTE dir=3Dltr style=3D"MARGIN-RIGHT: 0px"><PRE>package =
com.hmamg.quote;</PRE><PRE>import java.util.ArrayList;<BR>import =
java.util.Iterator;</PRE><PRE>public class TestDataSource =
{<BR>&nbsp;<BR>&nbsp;public static Iterator getListIterator() =
{<BR>&nbsp;&nbsp;ArrayList retval =3D new =
ArrayList();<BR>&nbsp;&nbsp;retval.add(new SomeDataObject(33, "First =
Item"));<BR>&nbsp;&nbsp;retval.add(new SomeDataObject(54, "Second =
Item"));<BR>&nbsp;&nbsp;return =
retval.iterator();<BR>&nbsp;}<BR>&nbsp;<BR>&nbsp;static class =
SomeDataObject {<BR>&nbsp;&nbsp;public SomeDataObject(int rate, String =
name) {<BR>&nbsp;&nbsp;&nbsp;this.rate =3D =
rate;<BR>&nbsp;&nbsp;&nbsp;this.name =3D =
name;<BR>&nbsp;&nbsp;}</PRE><PRE>&nbsp;&nbsp;private int =
rate;<BR>&nbsp;&nbsp;<BR>&nbsp;&nbsp;private String =
name;</PRE><PRE>&nbsp;&nbsp;public String getName() =
{<BR>&nbsp;&nbsp;&nbsp;return =
name;<BR>&nbsp;&nbsp;}</PRE><PRE>&nbsp;&nbsp;public void setName(String =
name) {<BR>&nbsp;&nbsp;&nbsp;this.name =3D =
name;<BR>&nbsp;&nbsp;}</PRE><PRE>&nbsp;&nbsp;public int getRate() =
{<BR>&nbsp;&nbsp;&nbsp;return =
rate;<BR>&nbsp;&nbsp;}</PRE><PRE>&nbsp;&nbsp;public void setRate(int =
rate) {<BR>&nbsp;&nbsp;&nbsp;this.rate =3D =
rate;<BR>&nbsp;&nbsp;}<BR>&nbsp;}<BR>}<BR ></PRE></BLOCKQUOTE>
<DIV><FONT face=3DArial color=3D#0000ff size=3D2>I try to access =
this class in my=20
script method called <EM>open()</EM> on the Scripted Data Set that I =
created=20
earlier in the tutorial</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<BLOCKQUOTE dir=3Dltr style=3D"MARGIN-RIGHT: =
0px"><PRE>importPackage(Packages.com.hmamg.quote);</PRE><PRE >var myList =
=3D Packages.com.hmamg.quote.TestDataSource.getList();</PRE><PRE >var =
iter =3D myList.getIterator();</PRE></BLOCKQUOTE>
<P dir=3Dltr><FONT face=3DArial size=3D2><FONT color=3D#0000ff>And =
here's the script=20
called <EM>fetch()</EM></FONT></FONT></P>
<BLOCKQUOTE dir=3Dltr style=3D"MARGIN-RIGHT: =
0px"><PRE>if(iter.hasNext() =3D=3D false){</PRE><PRE>return =
false;</PRE><PRE>}</PRE><PRE>var node =3D iter.next();</PRE><PRE>row[1] =
=3D node.getRate();</PRE><PRE>row[2] =3D =
node.getName();</PRE><PRE>return true;</PRE></BLOCKQUOTE>
<P dir=3Dltr><FONT face=3DArial size=3D2><FONT=20
color=3D#0000ff></FONT></FONT>&nbsp;</P>
<P dir=3Dltr><FONT face=3DArial color=3D#0000ff size=3D2>I have =
defined the two=20
columns in the report, and I am trying to show them in a table just =
like I=20
did in the earlier parts of Tutorial Two.</FONT></P>
<P dir=3Dltr><FONT face=3DArial size=3D2><FONT color=3D#0000ff>And =
this is from the=20
stack trace that the report throws when trying to run =
it</FONT>.</FONT></P>
<BLOCKQUOTE dir=3Dltr style=3D"MARGIN-RIGHT: 0px"><PRE =
dir=3Dltr><DIV>The following items have errors: </DIV><BR><DIV><DIV =
id=3Derror_title style=3D"TEXT-DECORATION: underline">Table (id =3D 6): =
</DIV><DIV><SPAN id=3Derror_icon0_0 style=3D"CURSOR: pointer" =
onclick=3D"if (document.getElementById('error_detail0_0').style.display =
=3D=3D 'none') { document.getElementById('error_icon0_0').innerHTML =3D =
'- '; document.getElementById('error_detail0_0').style.display =3D =
'block'; }else { document.getElementById('error_icon0_0').innerHTML =3D =
'+ '; document.getElementById('error_detail0_0').style.display =3D =
'none'; }">- </SPAN>There are errors evaluating script =
"importPackage(Packages.com.hmamg.quote);<BR><BR>var myList =3D =
Packages.com.hmamg.quote.TestDataSource.getList();<BR>var iter =3D =
myList.getIterator();". <PRE id=3Derror_detail0_0 style=3D"DISPLAY: =
block">Error.ScriptEvaluationError ( 1 time(s) )
detail : org.eclipse.birt.report.engine.api.EngineException: There are =
errors evaluating script =
"importPackage(Packages.com.hmamg.quote);<BR><BR>var myList =3D =
Packages.com.hmamg.quote.TestDataSource.getList();<BR>var iter =3D =
myList.getIterator();<BR>recordCount =3D 0;".<BR>&nbsp;at =
org.eclipse.birt.report.engine.script.internal.DtEScriptExec utor.handleJS=
(DtEScriptExecutor.java:76)<BR>&nbsp;at =
org.eclipse.birt.report.engine.script.internal.DataSetScript Executor.hand=
leJS(DataSetScriptExecutor.java:159)<BR>&nbsp;at =
org.eclipse.birt.report.engine.script.internal.ScriptDataSet ScriptExecuto=
r.handleOpen(ScriptDataSetScriptExecutor.java:66)<BR>&nbsp;at =
org.eclipse.birt.data.engine.impl.ScriptDataSetRuntime.open( ScriptDataSet=
Runtime.java:68)<BR>&nbsp;at =
org.eclipse.birt.data.engine.impl.PreparedScriptDSQuery$Scri ptDSQueryExec=
utor$CustomDataSet.open(PreparedScriptDSQuery.java:233)<BR>&nbsp;at =
org.eclipse.birt.data.engine.impl.PreparedScriptDSQuery$Scri ptDSQueryExec=
utor.executeOdiQuery(PreparedScriptDSQuery.java:209)<BR>&nbsp;at =
org.eclipse.birt.data.engine.impl.QueryExecutor.execute(Quer yExecutor.jav=
a:735)<BR>&nbsp;at =
org.eclipse.birt.data.engine.impl.ServiceForQueryResults.exe cuteQuery(Ser=
viceForQueryResults.java:181)<BR>&nbsp;at =
org.eclipse.birt.data.engine.impl.QueryResults.getResultIter ator(QueryRes=
ults.java:137)<BR>&nbsp;at =
org.eclipse.birt.report.engine.data.dte.DteResultSet.&lt ;init&gt;(DteResu=
ltSet.java:86)<BR>&nbsp;at =
org.eclipse.birt.report.engine.data.dte.DteDataEngine.doExec uteQuery(DteD=
ataEngine.java:115)<BR>&nbsp;at =
org.eclipse.birt.report.engine.data.dte.AbstractDataEngine.e xecute(Abstra=
ctDataEngine.java:208)<BR>&nbsp;at =
org.eclipse.birt.report.engine.executor.ExecutionContext.exe cuteQuery(Exe=
cutionContext.java:1640)<BR>&nbsp;at =
org.eclipse.birt.report.engine.executor.QueryItemExecutor.ex ecuteQuery(Qu=
eryItemExecutor.java:62)<BR>&nbsp;at =
org.eclipse.birt.report.engine.executor.TableItemExecutor.ex ecute(TableIt=
emExecutor.java:74)<BR>&nbsp;at =
org.eclipse.birt.report.engine.internal.executor.l18n.Locali zedReportItem=
Executor.execute(LocalizedReportItemExecutor.java:35)<BR>&nbsp;at =
org.eclipse.birt.report.engine.layout.html.HTMLPageLM.layout Children(HTML=
PageLM.java:123)<BR>&nbsp;at =
org.eclipse.birt.report.engine.layout.html.HTMLPageLM.layout (HTMLPageLM.j=
ava:81)<BR>&nbsp;at =
org.eclipse.birt.report.engine.layout.html.HTMLReportLayoutE ngine.layout(=
HTMLReportLayoutEngine.java:80)<BR>&nbsp;at =
org.eclipse.birt.report.engine.api.impl.RunAndRenderTask.run (RunAndRender=
Task.java:194)<BR>&nbsp;at =
com.hmamg.reporting.ReportRunner.runReport(ReportRunner.java :163) <BR>&nbs=
p;at =
com.hmamg.reporting.ReportRunner.runHTMLReport(ReportRunner. java:119) <BR>=
&nbsp;at =
com.hmamg.quote.mediators.QuotePreviewMediator.runReport(Quo tePreviewMedi=
ator.java:173)<BR>&nbsp;at =
com.hmamg.quote.mediators.QuotePreviewMediator.access$0(Quot ePreviewMedia=
tor.java:169)<BR>&nbsp;at =
com.hmamg.quote.mediators.QuotePreviewMediator$1.run(QuotePr eviewMediator=
..java:72)<BR>&nbsp;at =
org.eclipse.swt.custom.BusyIndicator.showWhile(BusyIndicator .java:67) <BR>=
&nbsp;at =
com.hmamg.quote.mediators.QuotePreviewMediator.calculate(Quo tePreviewMedi=
ator.java:75)<BR>&nbsp;at =
com.hmamg.quote.mediators.QuotePreviewMediator.focusGained(Q uotePreviewMe=
diator.java:219)<BR>&nbsp;at =
com.hmamg.quote.components.QuoteTabComposite.updateFocus(Quo teTabComposit=
e.java:97)<BR>&nbsp;at =
com.hmamg.quote.components.QuoteTabComposite.access$0(QuoteT abComposite.j=
ava:82)<BR>&nbsp;at =
com.hmamg.quote.components.QuoteTabComposite$1.widgetSelecte d(QuoteTabCom=
posite.java:77)<BR>&nbsp;at =
org.eclipse.swt.widgets.TypedListener.handleEvent(TypedListe ner.java:90) <=
BR>&nbsp;at =
org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java :66) <BR>&nbsp=
;at =
org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:928)<BR >&nbsp;at =
org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:952)<BR >&nbsp;at =
org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:937)<BR >&nbsp;at =
org.eclipse.swt.widgets.Widget.notifyListeners(Widget.java:7 09) <BR>&nbsp;=
at =
org.eclipse.swt.custom.CTabFolder.setSelection(CTabFolder.ja va:3171) <BR>&=
nbsp;at =
org.eclipse.swt.custom.CTabFolder.onMouse(CTabFolder.java:19 53) <BR>&nbsp;=
at =
org.eclipse.swt.custom.CTabFolder$1.handleEvent(CTabFolder.j ava:288) <BR>&=
nbsp;at =
org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java :66) <BR>&nbsp=
;at =
org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:928)<BR >&nbsp;at =
org.eclipse.swt.widgets.Display.runDeferredEvents(Display.ja va:3348) <BR>&=
nbsp;at =
org.eclipse.swt.widgets.Display.readAndDispatch(Display.java :2968) <BR>&nb=
sp;at =
org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.jav a:1914) <BR>&n=
bsp;at =
org.eclipse.ui.internal.Workbench.runUI(Workbench.java:1878) <BR>&nbsp;at =
org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Work bench.java:41=
9)<BR>&nbsp;at =
org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.j ava:149) <BR>&=
nbsp;at =
com.hmamg.application.welcome.Application.run(Application.ja va:105) <BR>&n=
bsp;at =
org.eclipse.core.internal.runtime.PlatformActivator$1.run(Pl atformActivat=
or.java:78)<BR>&nbsp;at =
org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher .runApplicati=
on(EclipseAppLauncher.java:92)<BR>&nbsp;at =
org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher .start(Eclips=
eAppLauncher.java:68)<BR>&nbsp;at =
org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseS tarter.java:4=
00)<BR>&nbsp;at =
org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseS tarter.java:1=
77)<BR>&nbsp;at sun.reflect.NativeMethodAccessorImpl.invoke0(Native =
Method)<BR>&nbsp;at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown =
Source)<BR>&nbsp;at =
sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown =
Source)<BR>&nbsp;at java.lang.reflect.Method.invoke(Unknown =
Source)<BR>&nbsp;at =
org.eclipse.core.launcher.Main.invokeFramework(Main.java:336 ) <BR>&nbsp;at=
org.eclipse.core.launcher.Main.basicRun(Main.java:280)<BR>&nbsp;at =
org.eclipse.core.launcher.Main.run(Main.java:977)<BR>&nbsp;at =
org.eclipse.core.launcher.Main.main(Main.java:952)<BR>Caused by: =
org.eclipse.birt.data.engine.core.DataException: A BIRT exception =
occurred: Error evaluating Javascript expression. Script engine error: =
TypeError: getList is not a function. (DataSet[Scripted Data =
Set].__bm_OPEN#4)<BR> Script source: DataSet[Scripted Data =
Set].__bm_OPEN, line: 1, text:<BR>__bm_OPEN(). See next exception for =
more information.<BR>Error evaluating Javascript expression. Script =
engine error: TypeError: getList is not a function. (DataSet[Scripted =
Data Set].__bm_OPEN#4)<BR> Script source: DataSet[Scripted Data =
Set].__bm_OPEN, line: 1, text:<BR>__bm_OPEN()<BR>&nbsp;at =
org.eclipse.birt.data.engine.core.DataException.wrap(DataExc eption.java:1=
18)<BR>&nbsp;at =
org.eclipse.birt.data.engine.script.ScriptEvalUtil.evaluateJ SAsExpr(Scrip=
tEvalUtil.java:552)<BR>&nbsp;at =
org.eclipse.birt.data.engine.script.JSMethodRunner.runScript (JSMethodRunn=
er.java:79)<BR>&nbsp;at =
org.eclipse.birt.report.engine.script.internal.DtEScriptExec utor.handleJS=
(DtEScriptExecutor.java:71)<BR>&nbsp;... 61 more<BR>Caused by: =
org.eclipse.birt.core.exception.CoreException: Error evaluating =
Javascript expression. Script engine error: TypeError: getList is not a =
function. (DataSet[Scripted Data Set].__bm_OPEN#4)<BR> Script source: =
DataSet[Scripted Data Set].__bm_OPEN, line: 1, =
text:<BR>__bm_OPEN()<BR>&nbsp;at =
org.eclipse.birt.core.script.JavascriptEvalUtil.wrapRhinoExc eption(Javasc=
riptEvalUtil.java:281)<BR>&nbsp;at =
org.eclipse.birt.core.script.JavascriptEvalUtil.evaluateRawS cript(Javascr=
iptEvalUtil.java:105)<BR>&nbsp;at =
org.eclipse.birt.core.script.JavascriptEvalUtil.evaluateScri pt(Javascript=
EvalUtil.java:137)<BR>&nbsp;at =
org.eclipse.birt.data.engine.script.ScriptEvalUtil.evaluateJ SAsExpr(Scrip=
tEvalUtil.java:548)<BR>&nbsp;... 63 more<BR>Caused by: =
org.mozilla.javascript.EcmaError: TypeError: getList is not a function. =
(DataSet[Scripted Data Set].__bm_OPEN#4)<BR>&nbsp;at =
org.mozilla.javascript.ScriptRuntime.constructError(ScriptRu ntime.java:32=
40)<BR>&nbsp;at =
org.mozilla.javascript.ScriptRuntime.constructError(ScriptRu ntime.java:32=
30)<BR>&nbsp;at =
org.mozilla.javascript.ScriptRuntime.typeError(ScriptRuntime .java:3246) <B=
R>&nbsp;at =
org.mozilla.javascript.ScriptRuntime.typeError1(ScriptRuntim e.java:3258) <=
BR>&nbsp;at =
org.mozilla.javascript.ScriptRuntime.notFunctionError(Script Runtime.java:=
3317)<BR>&nbsp;at =
org.mozilla.javascript.ScriptRuntime.getPropFunctionAndThis( ScriptRuntime=
..java:1987)<BR>&nbsp;at =
org.mozilla.javascript.optimizer.OptRuntime.callProp0(OptRun time.java:114=
)<BR>&nbsp;at org.mozilla.javascript.gen.c6._c1(DataSet[Scripted Data =
Set].__bm_OPEN:4)<BR>&nbsp;at =
org.mozilla.javascript.gen.c6.call(DataSet[Scripted Data =
Set].__bm_OPEN)<BR>&nbsp;at =
org.mozilla.javascript.optimizer.OptRuntime.callName0(OptRun time.java:105=
)<BR>&nbsp;at org.mozilla.javascript.gen.c5._c0(DataSource[Scripted Data =
Source].__bm_OPEN:1)<BR>&nbsp;at =
org.mozilla.javascript.gen.c5.call(DataSource[Scripted Data =
Source].__bm_OPEN)<BR>&nbsp;at =
org.mozilla.javascript.ContextFactory.doTopCall(ContextFacto ry.java:304) <=
BR>&nbsp;at =
org.mozilla.javascript.ScriptRuntime.doTopCall(ScriptRuntime .java:2769) <B=
R>&nbsp;at org.mozilla.javascript.gen.c5.call(DataSource[Scripted Data =
Source].__bm_OPEN)<BR>&nbsp;at =
org.mozilla.javascript.gen.c5.exec(DataSource[Scripted Data =
Source].__bm_OPEN)<BR>&nbsp;at =
org.eclipse.birt.core.script.JavascriptEvalUtil.evaluateRawS cript(Javascr=
iptEvalUtil.java:98)<BR>&nbsp;... 65 =
more<BR><BR></PRE></DIV></DIV></PRE></BLOCKQUOTE>
<DIV dir=3Dltr><FONT face=3DArial color=3D#0000ff size=3D2>I am =
working on an RCP=20
project.&nbsp; The report file and the java object in question are =
in the=20
same plug-in project.&nbsp; I am using the RE API (Report Engine =
API) to=20
produce my report in an SWT Browser widget.&nbsp; I can successfully =
run a=20
report that has no data set created.&nbsp; </FONT></DIV>
<DIV dir=3Dltr><FONT face=3DArial color=3D#0000ff =
size=3D2></FONT>&nbsp;</DIV>
<DIV dir=3Dltr><FONT face=3DArial color=3D#0000ff size=3D2>I think =
my problem is a=20
complete lack of knowledge of JavaScript.&nbsp; I have no idea where =
to=20
start debugging the script methods.</FONT></DIV>
<DIV dir=3Dltr><FONT face=3DArial color=3D#0000ff =
size=3D2></FONT>&nbsp;</DIV>
<DIV dir=3Dltr><FONT face=3DArial color=3D#0000ff size=3D2>Help me =
Jason Weathersby,=20
you're my only hope.&nbsp; I am on a tight deadline, and this is the =
last=20
big feature to implement&nbsp;before my RCP application has to=20
ship.</FONT></DIV>
<DIV dir=3Dltr><FONT face=3DArial color=3D#0000ff =
size=3D2></FONT>&nbsp;</DIV>
<DIV dir=3Dltr><FONT face=3DArial color=3D#0000ff =
size=3D2>Thanks,</FONT></DIV>
<DIV dir=3Dltr><FONT face=3DArial color=3D#0000ff size=3D2>Trace=20
Windham</FONT></DIV>
<DIV dir=3Dltr><FONT face=3DArial color=3D#0000ff =
size=3D2></FONT>&nbsp;</DIV>
<DIV dir=3Dltr><FONT face=3DArial color=3D#0000ff size=3D2>PS... See =
you at Eclipse=20
Con 2007</FONT></DIV></BLOCKQUOTE></BLOCKQUOTE></BODY></HTML >

------=_NextPart_000_000A_01C71A05.A8F73380--
Re: Using Java Objects access a Data Source [message #205468 is a reply to message #205431] Thu, 07 December 2006 21:50 Go to previous message
Jason Weathersby is currently offline Jason WeathersbyFriend
Messages: 9167
Registered: July 2009
Senior Member

This is a multi-part message in MIME format.

------=_NextPart_000_0017_01C71A1F.CF362910
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

Trace,

You are correct that it can not find your class.
You could try setting this property
System.setProperty( EngineConstants.WEBAPP_CLASSPATH_KEY, "c:/myclasses" =
);



Jason



"Trace Windham" <twindham@ugaais.com> wrote in message =
news:el9qsr$am0$1@utils.eclipse.org...
Opps. =20

I had made that correction already, the bug was that I cut and pasted =
the wrong code in this message. With that said, I went back and I tried =
your suggestion. Now the stack trace is exactly the same, except it =
says that the=20

.... getListIterator is not a function instead of... getList is not a =
function.I've tried taking the static identifier off of the method =
getList(), and running this code:
=20
var dataClass =3D new Packages.com.hmamg.quote.TestDataSource();var iter =
=3D dataClass.getListIterator();
And I get the same stack trace as before with only one difference:

.... TestDataSource is not a function;
It looks like the report cannot find the class, TestDataSource.java =
It exists in the same plug in project as the report. =20

Is there a special way the report finds the classpath when the Report =
Engine API is being used instead of the BIRT Web Viewer?

Although I'm not using it yet, could this method below impact my =
problem? Just curious.
IRunAndRenderTask task =3D =
engine.createRunAndRenderTask(design);task.addScriptableJava Object(String=
, Object);Thanks in advance for all your help. =20
Trace =20


"Jason Weathersby" <jweathersby@actuate.com> wrote in message =
news:el9cjb$tst$1@utils.eclipse.org...
Trace,

You have no getList method in your java code.

Either add one to the TestDataSource or try
changing this code in the =
openimportPackage(Packages.com.hmamg.quote);var myList =3D =
Packages.com.hmamg.quote.TestDataSource.getList();var iter =3D =
myList.getIterator(); to importPackage(Packages.com.hmamg.quote);var =
iter =3D Packages.com.hmamg.quote.TestDataSource.getListIterator(); =
Jason "Trace Windham" <twindham@ugaais.com> wrote in message =
news:el7ja3$o76$1@utils.eclipse.org...Hello all,

I'm trying to implement the "Tutorial #2: Creating a Scripted Data =
Source" that is layed out in the book Integrating and Extending Birt on =
page 133.

Everything works great until I try to implement the section called =
"Using Java Objects to Access a Data Source".

I have a class called TestDataSource.java

package com.hmamg.quote;import java.util.ArrayList;import =
java.util.Iterator;public class TestDataSource { public static Iterator =
getListIterator() { ArrayList retval =3D new ArrayList(); =
retval.add(new SomeDataObject(33, "First Item")); retval.add(new =
SomeDataObject(54, "Second Item")); return retval.iterator(); } static =
class SomeDataObject { public SomeDataObject(int rate, String name) { =
this.rate =3D rate; this.name =3D name; } private int rate; =
private String name; public String getName() { return name; } =
public void setName(String name) { this.name =3D name; } public int =
getRate() { return rate; } public void setRate(int rate) { =
this.rate =3D rate; } }}I try to access this class in my script method =
called open() on the Scripted Data Set that I created earlier in the =
tutorial

importPackage(Packages.com.hmamg.quote);var myList =3D =
Packages.com.hmamg.quote.TestDataSource.getList();var iter =3D =
myList.getIterator();And here's the script called fetch()

if(iter.hasNext() =3D=3D false){return false;}var node =3D =
iter.next();row[1] =3D node.getRate();row[2] =3D node.getName();return =
true;

I have defined the two columns in the report, and I am trying to =
show them in a table just like I did in the earlier parts of Tutorial =
Two.

And this is from the stack trace that the report throws when =
trying to run it.

The following items have errors: Table (id =3D 6): - There are errors =
evaluating script "importPackage(Packages.com.hmamg.quote);var myList =
=3D Packages.com.hmamg.quote.TestDataSource.getList();var iter =3D =
myList.getIterator();". Error.ScriptEvaluationError ( 1 time(s) )
detail : org.eclipse.birt.report.engine.api.EngineException: There are =
errors evaluating script "importPackage(Packages.com.hmamg.quote);var =
myList =3D Packages.com.hmamg.quote.TestDataSource.getList();var iter =
=3D myList.getIterator();recordCount =3D 0;". at =
org.eclipse.birt.report.engine.script.internal.DtEScriptExec utor.handleJS=
(DtEScriptExecutor.java:76) at =
org.eclipse.birt.report.engine.script.internal.DataSetScript Executor.hand=
leJS(DataSetScriptExecutor.java:159) at =
org.eclipse.birt.report.engine.script.internal.ScriptDataSet ScriptExecuto=
r.handleOpen(ScriptDataSetScriptExecutor.java:66) at =
org.eclipse.birt.data.engine.impl.ScriptDataSetRuntime.open( ScriptDataSet=
Runtime.java:68) at =
org.eclipse.birt.data.engine.impl.PreparedScriptDSQuery$Scri ptDSQueryExec=
utor$CustomDataSet.open(PreparedScriptDSQuery.java:233) at =
org.eclipse.birt.data.engine.impl.PreparedScriptDSQuery$Scri ptDSQueryExec=
utor.executeOdiQuery(PreparedScriptDSQuery.java:209) at =
org.eclipse.birt.data.engine.impl.QueryExecutor.execute(Quer yExecutor.jav=
a:735) at =
org.eclipse.birt.data.engine.impl.ServiceForQueryResults.exe cuteQuery(Ser=
viceForQueryResults.java:181) at =
org.eclipse.birt.data.engine.impl.QueryResults.getResultIter ator(QueryRes=
ults.java:137) at =
org.eclipse.birt.report.engine.data.dte.DteResultSet.<init>(DteResultSet.=
java:86) at =
org.eclipse.birt.report.engine.data.dte.DteDataEngine.doExec uteQuery(DteD=
ataEngine.java:115) at =
org.eclipse.birt.report.engine.data.dte.AbstractDataEngine.e xecute(Abstra=
ctDataEngine.java:208) at =
org.eclipse.birt.report.engine.executor.ExecutionContext.exe cuteQuery(Exe=
cutionContext.java:1640) at =
org.eclipse.birt.report.engine.executor.QueryItemExecutor.ex ecuteQuery(Qu=
eryItemExecutor.java:62) at =
org.eclipse.birt.report.engine.executor.TableItemExecutor.ex ecute(TableIt=
emExecutor.java:74) at =
org.eclipse.birt.report.engine.internal.executor.l18n.Locali zedReportItem=
Executor.execute(LocalizedReportItemExecutor.java:35) at =
org.eclipse.birt.report.engine.layout.html.HTMLPageLM.layout Children(HTML=
PageLM.java:123) at =
org.eclipse.birt.report.engine.layout.html.HTMLPageLM.layout (HTMLPageLM.j=
ava:81) at =
org.eclipse.birt.report.engine.layout.html.HTMLReportLayoutE ngine.layout(=
HTMLReportLayoutEngine.java:80) at =
org.eclipse.birt.report.engine.api.impl.RunAndRenderTask.run (RunAndRender=
Task.java:194) at =
com.hmamg.reporting.ReportRunner.runReport(ReportRunner.java :163) at =
com.hmamg.reporting.ReportRunner.runHTMLReport(ReportRunner. java:119) at =
com.hmamg.quote.mediators.QuotePreviewMediator.runReport(Quo tePreviewMedi=
ator.java:173) at =
com.hmamg.quote.mediators.QuotePreviewMediator.access$0(Quot ePreviewMedia=
tor.java:169) at =
com.hmamg.quote.mediators.QuotePreviewMediator$1.run(QuotePr eviewMediator=
..java:72) at =
org.eclipse.swt.custom.BusyIndicator.showWhile(BusyIndicator .java:67) at =
com.hmamg.quote.mediators.QuotePreviewMediator.calculate(Quo tePreviewMedi=
ator.java:75) at =
com.hmamg.quote.mediators.QuotePreviewMediator.focusGained(Q uotePreviewMe=
diator.java:219) at =
com.hmamg.quote.components.QuoteTabComposite.updateFocus(Quo teTabComposit=
e.java:97) at =
com.hmamg.quote.components.QuoteTabComposite.access$0(QuoteT abComposite.j=
ava:82) at =
com.hmamg.quote.components.QuoteTabComposite$1.widgetSelecte d(QuoteTabCom=
posite.java:77) at =
org.eclipse.swt.widgets.TypedListener.handleEvent(TypedListe ner.java:90) =
at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java :66) at =
org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:928) at =
org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:952) at =
org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:937) at =
org.eclipse.swt.widgets.Widget.notifyListeners(Widget.java:7 09) at =
org.eclipse.swt.custom.CTabFolder.setSelection(CTabFolder.ja va:3171) at =
org.eclipse.swt.custom.CTabFolder.onMouse(CTabFolder.java:19 53) at =
org.eclipse.swt.custom.CTabFolder$1.handleEvent(CTabFolder.j ava:288) at =
org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java :66) at =
org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:928) at =
org.eclipse.swt.widgets.Display.runDeferredEvents(Display.ja va:3348) at =
org.eclipse.swt.widgets.Display.readAndDispatch(Display.java :2968) at =
org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.jav a:1914) at =
org.eclipse.ui.internal.Workbench.runUI(Workbench.java:1878) at =
org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Work bench.java:41=
9) at =
org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.j ava:149) at =
com.hmamg.application.welcome.Application.run(Application.ja va:105) at =
org.eclipse.core.internal.runtime.PlatformActivator$1.run(Pl atformActivat=
or.java:78) at =
org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher .runApplicati=
on(EclipseAppLauncher.java:92) at =
org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher .start(Eclips=
eAppLauncher.java:68) at =
org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseS tarter.java:4=
00) at =
org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseS tarter.java:1=
77) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at =
sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at =
sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at =
java.lang.reflect.Method.invoke(Unknown Source) at =
org.eclipse.core.launcher.Main.invokeFramework(Main.java:336 ) at =
org.eclipse.core.launcher.Main.basicRun(Main.java:280) at =
org.eclipse.core.launcher.Main.run(Main.java:977) at =
org.eclipse.core.launcher.Main.main(Main.java:952)Caused by: =
org.eclipse.birt.data.engine.core.DataException: A BIRT exception =
occurred: Error evaluating Javascript expression. Script engine error: =
TypeError: getList is not a function. (DataSet[Scripted Data =
Set].__bm_OPEN#4) Script source: DataSet[Scripted Data Set].__bm_OPEN, =
line: 1, text:__bm_OPEN(). See next exception for more information.Error =
evaluating Javascript expression. Script engine error: TypeError: =
getList is not a function. (DataSet[Scripted Data Set].__bm_OPEN#4) =
Script source: DataSet[Scripted Data Set].__bm_OPEN, line: 1, =
text:__bm_OPEN() at =
org.eclipse.birt.data.engine.core.DataException.wrap(DataExc eption.java:1=
18) at =
org.eclipse.birt.data.engine.script.ScriptEvalUtil.evaluateJ SAsExpr(Scrip=
tEvalUtil.java:552) at =
org.eclipse.birt.data.engine.script.JSMethodRunner.runScript (JSMethodRunn=
er.java:79) at =
org.eclipse.birt.report.engine.script.internal.DtEScriptExec utor.handleJS=
(DtEScriptExecutor.java:71) ... 61 moreCaused by: =
org.eclipse.birt.core.exception.CoreException: Error evaluating =
Javascript expression. Script engine error: TypeError: getList is not a =
function. (DataSet[Scripted Data Set].__bm_OPEN#4) Script source: =
DataSet[Scripted Data Set].__bm_OPEN, line: 1, text:__bm_OPEN() at =
org.eclipse.birt.core.script.JavascriptEvalUtil.wrapRhinoExc eption(Javasc=
riptEvalUtil.java:281) at =
org.eclipse.birt.core.script.JavascriptEvalUtil.evaluateRawS cript(Javascr=
iptEvalUtil.java:105) at =
org.eclipse.birt.core.script.JavascriptEvalUtil.evaluateScri pt(Javascript=
EvalUtil.java:137) at =
org.eclipse.birt.data.engine.script.ScriptEvalUtil.evaluateJ SAsExpr(Scrip=
tEvalUtil.java:548) ... 63 moreCaused by: =
org.mozilla.javascript.EcmaError: TypeError: getList is not a function. =
(DataSet[Scripted Data Set].__bm_OPEN#4) at =
org.mozilla.javascript.ScriptRuntime.constructError(ScriptRu ntime.java:32=
40) at =
org.mozilla.javascript.ScriptRuntime.constructError(ScriptRu ntime.java:32=
30) at =
org.mozilla.javascript.ScriptRuntime.typeError(ScriptRuntime .java:3246) =
at =
org.mozilla.javascript.ScriptRuntime.typeError1(ScriptRuntim e.java:3258) =
at =
org.mozilla.javascript.ScriptRuntime.notFunctionError(Script Runtime.java:=
3317) at =
org.mozilla.javascript.ScriptRuntime.getPropFunctionAndThis( ScriptRuntime=
..java:1987) at =
org.mozilla.javascript.optimizer.OptRuntime.callProp0(OptRun time.java:114=
) at org.mozilla.javascript.gen.c6._c1(DataSet[Scripted Data =
Set].__bm_OPEN:4) at org.mozilla.javascript.gen.c6.call(DataSet[Scripted =
Data Set].__bm_OPEN) at =
org.mozilla.javascript.optimizer.OptRuntime.callName0(OptRun time.java:105=
) at org.mozilla.javascript.gen.c5._c0(DataSource[Scripted Data =
Source].__bm_OPEN:1) at =
org.mozilla.javascript.gen.c5.call(DataSource[Scripted Data =
Source].__bm_OPEN) at =
org.mozilla.javascript.ContextFactory.doTopCall(ContextFacto ry.java:304) =
at =
org.mozilla.javascript.ScriptRuntime.doTopCall(ScriptRuntime .java:2769) =
at org.mozilla.javascript.gen.c5.call(DataSource[Scripted Data =
Source].__bm_OPEN) at =
org.mozilla.javascript.gen.c5.exec(DataSource[Scripted Data =
Source].__bm_OPEN) at =
org.eclipse.birt.core.script.JavascriptEvalUtil.evaluateRawS cript(Javascr=
iptEvalUtil.java:98) ... 65 moreI am working on an RCP project. The =
report file and the java object in question are in the same plug-in =
project. I am using the RE API (Report Engine API) to produce my report =
in an SWT Browser widget. I can successfully run a report that has no =
data set created. =20

I think my problem is a complete lack of knowledge of JavaScript. =
I have no idea where to start debugging the script methods.

Help me Jason Weathersby, you're my only hope. I am on a tight =
deadline, and this is the last big feature to implement before my RCP =
application has to ship.

Thanks,
Trace Windham

PS... See you at Eclipse Con 2007
------=_NextPart_000_0017_01C71A1F.CF362910
Content-Type: text/html;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=3DContent-Type content=3D"text/html; =
charset=3Diso-8859-1">
<META content=3D"MSHTML 6.00.2900.2963" name=3DGENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=3D#ffffff>
<DIV><FONT face=3DArial size=3D2>Trace,</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>You are correct that it can not find =
your=20
class.</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>You could try setting this =
property</FONT></DIV>
<DIV><FONT size=3D2>
<P align=3Dleft>System.<I>setProperty</I>( =
EngineConstants.</FONT><I><FONT=20
color=3D#0000c0 size=3D2>WEBAPP_CLASSPATH_KEY</I></FONT><FONT size=3D2>, =
</FONT><FONT=20
color=3D#2a00ff size=3D2>"c:/myclasses"</FONT><FONT size=3D2> =
);</FONT></P>
<P align=3Dleft><FONT size=3D2></FONT>&nbsp;</P>
<P align=3Dleft><FONT size=3D2><FONT =
face=3DArial>Jason</FONT></FONT></P>
<P align=3Dleft><FONT size=3D2>&nbsp;</P></FONT></DIV>
<BLOCKQUOTE dir=3Dltr=20
style=3D"PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; =
BORDER-LEFT: #000000 2px solid; MARGIN-RIGHT: 0px">
<DIV>"Trace Windham" &lt;<A=20
href=3D"mailto:twindham@ugaais.com">twindham@ugaais.com</A>&gt; wrote =
in message=20
<A=20
=
href=3D"news:el9qsr$am0$1@utils.eclipse.org">news:el9qsr$am0$1@utils.ecli=
pse.org</A>...</DIV>
<DIV><FONT face=3DArial size=3D2>Opps.&nbsp; </FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>I had made that correction already, =
the bug was=20
that I cut and pasted the wrong code in this message.&nbsp; With that =
said, I=20
went back and I tried your suggestion.&nbsp; Now the stack trace is =
exactly=20
the same, except it says that the </FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<BLOCKQUOTE dir=3Dltr style=3D"MARGIN-RIGHT: 0px"><PRE>... =
getListIterator is not a function </PRE><PRE>instead of</PRE><PRE>... =
getList is not a function.</PRE></BLOCKQUOTE>
<DIV dir=3Dltr><FONT face=3DArial size=3D2>I've tried taking the =
static identifier=20
off of the method getList(), and&nbsp;running this code:</FONT></DIV>
<DIV dir=3Dltr>&nbsp;&nbsp;&nbsp;</DIV>
<BLOCKQUOTE dir=3Dltr style=3D"MARGIN-RIGHT: 0px"><PRE dir=3Dltr>var =
dataClass =3D new Packages.com.hmamg.quote.TestDataSource();</PRE><PRE =
dir=3Dltr>var iter =3D dataClass.getListIterator();</PRE></BLOCKQUOTE>
<DIV dir=3Dltr><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV dir=3Dltr><FONT face=3DArial size=3D2>And I get the same stack =
trace as before=20
with only one difference:</FONT></DIV>
<DIV dir=3Dltr><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<BLOCKQUOTE dir=3Dltr style=3D"MARGIN-RIGHT: 0px"><PRE dir=3Dltr>... =
TestDataSource is not a function;</PRE></BLOCKQUOTE>
<DIV dir=3Dltr><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV dir=3Dltr><FONT face=3DArial size=3D2>It looks like the report =
cannot find the=20
class, TestDataSource.java&nbsp; It exists in the same plug in project =
as the=20
report.&nbsp; </FONT></DIV>
<DIV dir=3Dltr><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV dir=3Dltr><FONT face=3DArial size=3D2>Is there a special way the =
report finds=20
the classpath when&nbsp;the Report Engine API is being used instead of =
the=20
BIRT Web Viewer?</FONT></DIV>
<DIV dir=3Dltr><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV dir=3Dltr><FONT face=3DArial size=3D2>Although I'm not using it =
yet, could this=20
method below</FONT><FONT face=3DArial size=3D2>&nbsp;impact my =
problem?&nbsp; Just=20
curious.</FONT></DIV>
<BLOCKQUOTE dir=3Dltr style=3D"MARGIN-RIGHT: 0px"><PRE =
dir=3Dltr>IRunAndRenderTask task =3D =
engine.createRunAndRenderTask(design);</PRE><PRE>task.addScriptableJavaOb=
ject(String, Object);</PRE></BLOCKQUOTE>
<DIV dir=3Dltr><FONT face=3DArial size=3D2>Thanks in advance for all =
your=20
help.&nbsp; </FONT></DIV>
<DIV dir=3Dltr><FONT face=3DArial size=3D2>Trace </FONT>&nbsp;</DIV>
<DIV dir=3Dltr><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV dir=3Dltr><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<BLOCKQUOTE dir=3Dltr=20
style=3D"PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; =
BORDER-LEFT: #000000 2px solid; MARGIN-RIGHT: 0px">
<DIV>"Jason Weathersby" &lt;<A=20
=
href=3D"mailto:jweathersby@actuate.com">jweathersby@actuate.com</A>&gt; =
wrote=20
in message <A=20
=
href=3D"news:el9cjb$tst$1@utils.eclipse.org">news:el9cjb$tst$1@utils.ecli=
pse.org</A>...</DIV>
<DIV><FONT face=3DArial size=3D2>Trace,</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>You have no getList method in your =
java=20
code.</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>Either add one to the =
TestDataSource or=20
try</FONT></DIV>
<DIV><PRE>changing this code in the =
open</PRE><PRE><PRE><PRE>importPackage(Packages.com.hmamg.quote); </PRE><P=
RE>var myList =3D =
Packages.com.hmamg.quote.TestDataSource.getList();</PRE><PRE >var iter =
=3D =
myList.getIterator();</PRE><PRE>&nbsp;</PRE><PRE>to </PRE><PRE>&nbsp;</PRE=
><PRE>&nbsp;</PRE></PRE><PRE>importPackage(Packages.com.hmamg.quote); </PR=
E><PRE>var iter =3D =
Packages.com.hmamg.quote.TestDataSource.getListIterator();</PRE ><PRE>&nbs=
p;</PRE><PRE>Jason </PRE><PRE>&nbsp;</PRE><PRE>"Trace Windham" &lt;<A =
href=3D"mailto:twindham@ugaais.com">twindham@ugaais.com</A>&gt; wrote in =
message <A =
href=3D"news:el7ja3$o76$1@utils.eclipse.org">news:el7ja3$o76$1@utils.ecli=
pse.org</A>...</PRE></PRE></DIV>
<BLOCKQUOTE dir=3Dltr=20
style=3D"PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; =
BORDER-LEFT: #000000 2px solid; MARGIN-RIGHT: 0px">
<DIV><FONT face=3DArial color=3D#0000ff size=3D2>Hello =
all,</FONT></DIV>
<DIV><FONT face=3DArial color=3D#0000ff =
size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial color=3D#0000ff size=3D2>I'm trying to =
implement the=20
"Tutorial #2: Creating a Scripted Data Source"&nbsp;that is layed =
out in=20
the&nbsp;book <EM><STRONG>Integrating and Extending =
Birt</STRONG></EM> on=20
page 133.</FONT></DIV>
<DIV><FONT face=3DArial color=3D#0000ff =
size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial color=3D#0000ff size=3D2>Everything works =
great until I=20
try to implement the section called "Using Java Objects to Access =
a Data=20
Source".</FONT></DIV>
<DIV><FONT face=3DArial color=3D#0000ff =
size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial color=3D#0000ff size=3D2>I have a class =
called=20
TestDataSource.java</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<BLOCKQUOTE dir=3Dltr style=3D"MARGIN-RIGHT: 0px"><PRE>package =
com.hmamg.quote;</PRE><PRE>import java.util.ArrayList;<BR>import =
java.util.Iterator;</PRE><PRE>public class TestDataSource =
{<BR>&nbsp;<BR>&nbsp;public static Iterator getListIterator() =
{<BR>&nbsp;&nbsp;ArrayList retval =3D new =
ArrayList();<BR>&nbsp;&nbsp;retval.add(new SomeDataObject(33, "First =
Item"));<BR>&nbsp;&nbsp;retval.add(new SomeDataObject(54, "Second =
Item"));<BR>&nbsp;&nbsp;return =
retval.iterator();<BR>&nbsp;}<BR>&nbsp;<BR>&nbsp;static class =
SomeDataObject {<BR>&nbsp;&nbsp;public SomeDataObject(int rate, String =
name) {<BR>&nbsp;&nbsp;&nbsp;this.rate =3D =
rate;<BR>&nbsp;&nbsp;&nbsp;this.name =3D =
name;<BR>&nbsp;&nbsp;}</PRE><PRE>&nbsp;&nbsp;private int =
rate;<BR>&nbsp;&nbsp;<BR>&nbsp;&nbsp;private String =
name;</PRE><PRE>&nbsp;&nbsp;public String getName() =
{<BR>&nbsp;&nbsp;&nbsp;return =
name;<BR>&nbsp;&nbsp;}</PRE><PRE>&nbsp;&nbsp;public void setName(String =
name) {<BR>&nbsp;&nbsp;&nbsp;this.name =3D =
name;<BR>&nbsp;&nbsp;}</PRE><PRE>&nbsp;&nbsp;public int getRate() =
{<BR>&nbsp;&nbsp;&nbsp;return =
rate;<BR>&nbsp;&nbsp;}</PRE><PRE>&nbsp;&nbsp;public void setRate(int =
rate) {<BR>&nbsp;&nbsp;&nbsp;this.rate =3D =
rate;<BR>&nbsp;&nbsp;}<BR>&nbsp;}<BR>}<BR ></PRE></BLOCKQUOTE>
<DIV><FONT face=3DArial color=3D#0000ff size=3D2>I try to access =
this class in=20
my script method called <EM>open()</EM> on the Scripted Data Set =
that I=20
created earlier in the tutorial</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<BLOCKQUOTE dir=3Dltr style=3D"MARGIN-RIGHT: =
0px"><PRE>importPackage(Packages.com.hmamg.quote);</PRE><PRE >var myList =
=3D Packages.com.hmamg.quote.TestDataSource.getList();</PRE><PRE >var =
iter =3D myList.getIterator();</PRE></BLOCKQUOTE>
<P dir=3Dltr><FONT face=3DArial size=3D2><FONT color=3D#0000ff>And =
here's the=20
script called <EM>fetch()</EM></FONT></FONT></P>
<BLOCKQUOTE dir=3Dltr style=3D"MARGIN-RIGHT: =
0px"><PRE>if(iter.hasNext() =3D=3D false){</PRE><PRE>return =
false;</PRE><PRE>}</PRE><PRE>var node =3D iter.next();</PRE><PRE>row[1] =
=3D node.getRate();</PRE><PRE>row[2] =3D =
node.getName();</PRE><PRE>return true;</PRE></BLOCKQUOTE>
<P dir=3Dltr><FONT face=3DArial size=3D2><FONT=20
color=3D#0000ff></FONT></FONT>&nbsp;</P>
<P dir=3Dltr><FONT face=3DArial color=3D#0000ff size=3D2>I have =
defined the two=20
columns in the report, and I am trying to show them in a table =
just like I=20
did in the earlier parts of Tutorial Two.</FONT></P>
<P dir=3Dltr><FONT face=3DArial size=3D2><FONT color=3D#0000ff>And =
this is from=20
the stack trace that the report throws when trying to run=20
it</FONT>.</FONT></P>
<BLOCKQUOTE dir=3Dltr style=3D"MARGIN-RIGHT: 0px"><PRE =
dir=3Dltr><DIV>The following items have errors: </DIV><BR><DIV><DIV =
id=3Derror_title style=3D"TEXT-DECORATION: underline">Table (id =3D 6): =
</DIV><DIV><SPAN id=3Derror_icon0_0 style=3D"CURSOR: pointer" =
onclick=3D"if (document.getElementById('error_detail0_0').style.display =
=3D=3D 'none') { document.getElementById('error_icon0_0').innerHTML =3D =
'- '; document.getElementById('error_detail0_0').style.display =3D =
'block'; }else { document.getElementById('error_icon0_0').innerHTML =3D =
'+ '; document.getElementById('error_detail0_0').style.display =3D =
'none'; }">- </SPAN>There are errors evaluating script =
"importPackage(Packages.com.hmamg.quote);<BR><BR>var myList =3D =
Packages.com.hmamg.quote.TestDataSource.getList();<BR>var iter =3D =
myList.getIterator();". <PRE id=3Derror_detail0_0 style=3D"DISPLAY: =
block">Error.ScriptEvaluationError ( 1 time(s) )
detail : org.eclipse.birt.report.engine.api.EngineException: There are =
errors evaluating script =
"importPackage(Packages.com.hmamg.quote);<BR><BR>var myList =3D =
Packages.com.hmamg.quote.TestDataSource.getList();<BR>var iter =3D =
myList.getIterator();<BR>recordCount =3D 0;".<BR>&nbsp;at =
org.eclipse.birt.report.engine.script.internal.DtEScriptExec utor.handleJS=
(DtEScriptExecutor.java:76)<BR>&nbsp;at =
org.eclipse.birt.report.engine.script.internal.DataSetScript Executor.hand=
leJS(DataSetScriptExecutor.java:159)<BR>&nbsp;at =
org.eclipse.birt.report.engine.script.internal.ScriptDataSet ScriptExecuto=
r.handleOpen(ScriptDataSetScriptExecutor.java:66)<BR>&nbsp;at =
org.eclipse.birt.data.engine.impl.ScriptDataSetRuntime.open( ScriptDataSet=
Runtime.java:68)<BR>&nbsp;at =
org.eclipse.birt.data.engine.impl.PreparedScriptDSQuery$Scri ptDSQueryExec=
utor$CustomDataSet.open(PreparedScriptDSQuery.java:233)<BR>&nbsp;at =
org.eclipse.birt.data.engine.impl.PreparedScriptDSQuery$Scri ptDSQueryExec=
utor.executeOdiQuery(PreparedScriptDSQuery.java:209)<BR>&nbsp;at =
org.eclipse.birt.data.engine.impl.QueryExecutor.execute(Quer yExecutor.jav=
a:735)<BR>&nbsp;at =
org.eclipse.birt.data.engine.impl.ServiceForQueryResults.exe cuteQuery(Ser=
viceForQueryResults.java:181)<BR>&nbsp;at =
org.eclipse.birt.data.engine.impl.QueryResults.getResultIter ator(QueryRes=
ults.java:137)<BR>&nbsp;at =
org.eclipse.birt.report.engine.data.dte.DteResultSet.&lt ;init&gt;(DteResu=
ltSet.java:86)<BR>&nbsp;at =
org.eclipse.birt.report.engine.data.dte.DteDataEngine.doExec uteQuery(DteD=
ataEngine.java:115)<BR>&nbsp;at =
org.eclipse.birt.report.engine.data.dte.AbstractDataEngine.e xecute(Abstra=
ctDataEngine.java:208)<BR>&nbsp;at =
org.eclipse.birt.report.engine.executor.ExecutionContext.exe cuteQuery(Exe=
cutionContext.java:1640)<BR>&nbsp;at =
org.eclipse.birt.report.engine.executor.QueryItemExecutor.ex ecuteQuery(Qu=
eryItemExecutor.java:62)<BR>&nbsp;at =
org.eclipse.birt.report.engine.executor.TableItemExecutor.ex ecute(TableIt=
emExecutor.java:74)<BR>&nbsp;at =
org.eclipse.birt.report.engine.internal.executor.l18n.Locali zedReportItem=
Executor.execute(LocalizedReportItemExecutor.java:35)<BR>&nbsp;at =
org.eclipse.birt.report.engine.layout.html.HTMLPageLM.layout Children(HTML=
PageLM.java:123)<BR>&nbsp;at =
org.eclipse.birt.report.engine.layout.html.HTMLPageLM.layout (HTMLPageLM.j=
ava:81)<BR>&nbsp;at =
org.eclipse.birt.report.engine.layout.html.HTMLReportLayoutE ngine.layout(=
HTMLReportLayoutEngine.java:80)<BR>&nbsp;at =
org.eclipse.birt.report.engine.api.impl.RunAndRenderTask.run (RunAndRender=
Task.java:194)<BR>&nbsp;at =
com.hmamg.reporting.ReportRunner.runReport(ReportRunner.java :163) <BR>&nbs=
p;at =
com.hmamg.reporting.ReportRunner.runHTMLReport(ReportRunner. java:119) <BR>=
&nbsp;at =
com.hmamg.quote.mediators.QuotePreviewMediator.runReport(Quo tePreviewMedi=
ator.java:173)<BR>&nbsp;at =
com.hmamg.quote.mediators.QuotePreviewMediator.access$0(Quot ePreviewMedia=
tor.java:169)<BR>&nbsp;at =
com.hmamg.quote.mediators.QuotePreviewMediator$1.run(QuotePr eviewMediator=
..java:72)<BR>&nbsp;at =
org.eclipse.swt.custom.BusyIndicator.showWhile(BusyIndicator .java:67) <BR>=
&nbsp;at =
com.hmamg.quote.mediators.QuotePreviewMediator.calculate(Quo tePreviewMedi=
ator.java:75)<BR>&nbsp;at =
com.hmamg.quote.mediators.QuotePreviewMediator.focusGained(Q uotePreviewMe=
diator.java:219)<BR>&nbsp;at =
com.hmamg.quote.components.QuoteTabComposite.updateFocus(Quo teTabComposit=
e.java:97)<BR>&nbsp;at =
com.hmamg.quote.components.QuoteTabComposite.access$0(QuoteT abComposite.j=
ava:82)<BR>&nbsp;at =
com.hmamg.quote.components.QuoteTabComposite$1.widgetSelecte d(QuoteTabCom=
posite.java:77)<BR>&nbsp;at =
org.eclipse.swt.widgets.TypedListener.handleEvent(TypedListe ner.java:90) <=
BR>&nbsp;at =
org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java :66) <BR>&nbsp=
;at =
org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:928)<BR >&nbsp;at =
org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:952)<BR >&nbsp;at =
org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:937)<BR >&nbsp;at =
org.eclipse.swt.widgets.Widget.notifyListeners(Widget.java:7 09) <BR>&nbsp;=
at =
org.eclipse.swt.custom.CTabFolder.setSelection(CTabFolder.ja va:3171) <BR>&=
nbsp;at =
org.eclipse.swt.custom.CTabFolder.onMouse(CTabFolder.java:19 53) <BR>&nbsp;=
at =
org.eclipse.swt.custom.CTabFolder$1.handleEvent(CTabFolder.j ava:288) <BR>&=
nbsp;at =
org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java :66) <BR>&nbsp=
;at =
org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:928)<BR >&nbsp;at =
org.eclipse.swt.widgets.Display.runDeferredEvents(Display.ja va:3348) <BR>&=
nbsp;at =
org.eclipse.swt.widgets.Display.readAndDispatch(Display.java :2968) <BR>&nb=
sp;at =
org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.jav a:1914) <BR>&n=
bsp;at =
org.eclipse.ui.internal.Workbench.runUI(Workbench.java:1878) <BR>&nbsp;at =
org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Work bench.java:41=
9)<BR>&nbsp;at =
org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.j ava:149) <BR>&=
nbsp;at =
com.hmamg.application.welcome.Application.run(Application.ja va:105) <BR>&n=
bsp;at =
org.eclipse.core.internal.runtime.PlatformActivator$1.run(Pl atformActivat=
or.java:78)<BR>&nbsp;at =
org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher .runApplicati=
on(EclipseAppLauncher.java:92)<BR>&nbsp;at =
org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher .start(Eclips=
eAppLauncher.java:68)<BR>&nbsp;at =
org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseS tarter.java:4=
00)<BR>&nbsp;at =
org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseS tarter.java:1=
77)<BR>&nbsp;at sun.reflect.NativeMethodAccessorImpl.invoke0(Native =
Method)<BR>&nbsp;at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown =
Source)<BR>&nbsp;at =
sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown =
Source)<BR>&nbsp;at java.lang.reflect.Method.invoke(Unknown =
Source)<BR>&nbsp;at =
org.eclipse.core.launcher.Main.invokeFramework(Main.java:336 ) <BR>&nbsp;at=
org.eclipse.core.launcher.Main.basicRun(Main.java:280)<BR>&nbsp;at =
org.eclipse.core.launcher.Main.run(Main.java:977)<BR>&nbsp;at =
org.eclipse.core.launcher.Main.main(Main.java:952)<BR>Caused by: =
org.eclipse.birt.data.engine.core.DataException: A BIRT exception =
occurred: Error evaluating Javascript expression. Script engine error: =
TypeError: getList is not a function. (DataSet[Scripted Data =
Set].__bm_OPEN#4)<BR> Script source: DataSet[Scripted Data =
Set].__bm_OPEN, line: 1, text:<BR>__bm_OPEN(). See next exception for =
more information.<BR>Error evaluating Javascript expression. Script =
engine error: TypeError: getList is not a function. (DataSet[Scripted =
Data Set].__bm_OPEN#4)<BR> Script source: DataSet[Scripted Data =
Set].__bm_OPEN, line: 1, text:<BR>__bm_OPEN()<BR>&nbsp;at =
org.eclipse.birt.data.engine.core.DataException.wrap(DataExc eption.java:1=
18)<BR>&nbsp;at =
org.eclipse.birt.data.engine.script.ScriptEvalUtil.evaluateJ SAsExpr(Scrip=
tEvalUtil.java:552)<BR>&nbsp;at =
org.eclipse.birt.data.engine.script.JSMethodRunner.runScript (JSMethodRunn=
er.java:79)<BR>&nbsp;at =
org.eclipse.birt.report.engine.script.internal.DtEScriptExec utor.handleJS=
(DtEScriptExecutor.java:71)<BR>&nbsp;... 61 more<BR>Caused by: =
org.eclipse.birt.core.exception.CoreException: Error evaluating =
Javascript expression. Script engine error: TypeError: getList is not a =
function. (DataSet[Scripted Data Set].__bm_OPEN#4)<BR> Script source: =
DataSet[Scripted Data Set].__bm_OPEN, line: 1, =
text:<BR>__bm_OPEN()<BR>&nbsp;at =
org.eclipse.birt.core.script.JavascriptEvalUtil.wrapRhinoExc eption(Javasc=
riptEvalUtil.java:281)<BR>&nbsp;at =
org.eclipse.birt.core.script.JavascriptEvalUtil.evaluateRawS cript(Javascr=
iptEvalUtil.java:105)<BR>&nbsp;at =
org.eclipse.birt.core.script.JavascriptEvalUtil.evaluateScri pt(Javascript=
EvalUtil.java:137)<BR>&nbsp;at =
org.eclipse.birt.data.engine.script.ScriptEvalUtil.evaluateJ SAsExpr(Scrip=
tEvalUtil.java:548)<BR>&nbsp;... 63 more<BR>Caused by: =
org.mozilla.javascript.EcmaError: TypeError: getList is not a function. =
(DataSet[Scripted Data Set].__bm_OPEN#4)<BR>&nbsp;at =
org.mozilla.javascript.ScriptRuntime.constructError(ScriptRu ntime.java:32=
40)<BR>&nbsp;at =
org.mozilla.javascript.ScriptRuntime.constructError(ScriptRu ntime.java:32=
30)<BR>&nbsp;at =
org.mozilla.javascript.ScriptRuntime.typeError(ScriptRuntime .java:3246) <B=
R>&nbsp;at =
org.mozilla.javascript.ScriptRuntime.typeError1(ScriptRuntim e.java:3258) <=
BR>&nbsp;at =
org.mozilla.javascript.ScriptRuntime.notFunctionError(Script Runtime.java:=
3317)<BR>&nbsp;at =
org.mozilla.javascript.ScriptRuntime.getPropFunctionAndThis( ScriptRuntime=
..java:1987)<BR>&nbsp;at =
org.mozilla.javascript.optimizer.OptRuntime.callProp0(OptRun time.java:114=
)<BR>&nbsp;at org.mozilla.javascript.gen.c6._c1(DataSet[Scripted Data =
Set].__bm_OPEN:4)<BR>&nbsp;at =
org.mozilla.javascript.gen.c6.call(DataSet[Scripted Data =
Set].__bm_OPEN)<BR>&nbsp;at =
org.mozilla.javascript.optimizer.OptRuntime.callName0(OptRun time.java:105=
)<BR>&nbsp;at org.mozilla.javascript.gen.c5._c0(DataSource[Scripted Data =
Source].__bm_OPEN:1)<BR>&nbsp;at =
org.mozilla.javascript.gen.c5.call(DataSource[Scripted Data =
Source].__bm_OPEN)<BR>&nbsp;at =
org.mozilla.javascript.ContextFactory.doTopCall(ContextFacto ry.java:304) <=
BR>&nbsp;at =
org.mozilla.javascript.ScriptRuntime.doTopCall(ScriptRuntime .java:2769) <B=
R>&nbsp;at org.mozilla.javascript.gen.c5.call(DataSource[Scripted Data =
Source].__bm_OPEN)<BR>&nbsp;at =
org.mozilla.javascript.gen.c5.exec(DataSource[Scripted Data =
Source].__bm_OPEN)<BR>&nbsp;at =
org.eclipse.birt.core.script.JavascriptEvalUtil.evaluateRawS cript(Javascr=
iptEvalUtil.java:98)<BR>&nbsp;... 65 =
more<BR><BR></PRE></DIV></DIV></PRE></BLOCKQUOTE>
<DIV dir=3Dltr><FONT face=3DArial color=3D#0000ff size=3D2>I am =
working on an RCP=20
project.&nbsp; The report file and the java object in question are =
in the=20
same plug-in project.&nbsp; I am using the RE API (Report Engine =
API) to=20
produce my report in an SWT Browser widget.&nbsp; I can =
successfully run a=20
report that has no data set created.&nbsp; </FONT></DIV>
<DIV dir=3Dltr><FONT face=3DArial color=3D#0000ff =
size=3D2></FONT>&nbsp;</DIV>
<DIV dir=3Dltr><FONT face=3DArial color=3D#0000ff size=3D2>I think =
my problem is a=20
complete lack of knowledge of JavaScript.&nbsp; I have no idea =
where to=20
start debugging the script methods.</FONT></DIV>
<DIV dir=3Dltr><FONT face=3DArial color=3D#0000ff =
size=3D2></FONT>&nbsp;</DIV>
<DIV dir=3Dltr><FONT face=3DArial color=3D#0000ff size=3D2>Help me =
Jason=20
Weathersby, you're my only hope.&nbsp; I am on a tight deadline, =
and this=20
is the last big feature to implement&nbsp;before my RCP =
application has to=20
ship.</FONT></DIV>
<DIV dir=3Dltr><FONT face=3DArial color=3D#0000ff =
size=3D2></FONT>&nbsp;</DIV>
<DIV dir=3Dltr><FONT face=3DArial color=3D#0000ff =
size=3D2>Thanks,</FONT></DIV>
<DIV dir=3Dltr><FONT face=3DArial color=3D#0000ff size=3D2>Trace=20
Windham</FONT></DIV>
<DIV dir=3Dltr><FONT face=3DArial color=3D#0000ff =
size=3D2></FONT>&nbsp;</DIV>
<DIV dir=3Dltr><FONT face=3DArial color=3D#0000ff size=3D2>PS... =
See you at=20
Eclipse Con=20
2007</FONT></DIV></BLOCKQUOTE></BLOCKQUOTE></BLOCKQUOTE ></BODY></HTML>

------=_NextPart_000_0017_01C71A1F.CF362910--
Previous Topic:Source Code of WebViewerExample ?
Next Topic:Couple of questions on centering / sizing
Goto Forum:
  


Current Time: Fri Mar 29 04:44:09 GMT 2024

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

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

Back to the top