Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Archived » BIRT » Tutorial 5, Field Guide to BIRT, problem running the "Writing an event handler in JavaScript&qu
Tutorial 5, Field Guide to BIRT, problem running the "Writing an event handler in JavaScript&qu [message #197914] Thu, 26 October 2006 22:51 Go to next message
Eclipse UserFriend
Originally posted by: home4slc.pacbell.net

This is a multi-part message in MIME format.
--------------050507090807010508070107
Content-Type: text/plain; charset=us-ascii; format=flowed
Content-Transfer-Encoding: 7bit

Hi,

Im having trouble with on of the tutorials in the on-line help, "Field
Guide to BIRT", and wondering if it is a bug or pilot error. I will be
happy to enter a bugzilla if it is a bug if someone can take a moment to
help with this.

I completed tutorial 1 and have a sample report based on completing this
tutorial. In tutorial 5, Writing an event handler in JavaScript, I've
found a problem when following the instructions.

In Task 2 of Tutorial 5, Create and initialize a counter in
Table.onCreate() method,
the screen shot, Figure 22-5 shows the row called row["CUSTOMERNAME"],
but I believe this should be dataSetRow["CUSTOMERNAME"]. (This is
irrelevant to the problem later, but I believe the screen shot is
incorrect?)

Also, in Task 3, step 4 here is the JavaScript:

CustName=row.getExpressionValue( "row[CUSTOMERNAME]" );

The output I get when running the report only shows the first column's
first row (cell 1) correctly (listing 1 below), and I'm getting a stack
trace, and the CountOfMinis never increments. Here is the interesting
part of the stack trace:

(ThreadPool.java:683) at java.lang.Thread.run(Unknown Source)Caused by:
org.mozilla.javascript.EcmaError: TypeError: Cannot call method
"indexOf" of null (<inline>#3)

So I changed the above line of JavaScript to this:

CustName=row.getExpressionValue("row["CUSTOMERNAME"]");

and I get all of the output, the CountOfMinis still does not increment
and I get this stack trace (Listing 2);

(ThreadPool.java:683) at java.lang.Thread.run(Unknown Source)Caused by:
org.mozilla.javascript.EvaluatorException: missing ) after argument list
(<inline>#4) at
org.mozilla.javascript.DefaultErrorReporter.runtimeError(Def aultErrorReporter.java:95)
at


I looked at the 2.1.1 version of the source and noticed that
getExpressionValue has been decremented. So I tried to modify the
example to what I thought would be correct and I still have problems.
I modified the code snippet for Task 3 to be this:

CustName = this.getRowData().getColumnValue(0);

Now I get the correct CountOfMinis, and no stack trace, but only the
first cell appears.

Can someone tell me the correct JavaScript to run this example? I've
also attached my report design file.

Regards,

Susan
************************************************************ ***************

Listing 2

------------------------------------------------------------ --------------------

The following items have errors:


Data (id = 23):
- There are errors evaluating script "row=this.getRowData();
//CustName = this.getRowData().getColumnValue(0);
//countOfMinis = row.getColumnValue("row[CUSTOMERNAME]");
CustName=row.getExpressionValue("row["CUSTOMERNAME"]");
if( CustName.indexOf("Mini") != -1 )
countOfMinis += 1;".
Error.ScriptEvaluationError ( 122 time(s) )
detail : org.eclipse.birt.report.engine.api.EngineException: There are
errors evaluating script "row=this.getRowData();//CustName =
this.getRowData().getColumnValue(0);//countOfMinis =
row.getColumnValue("row[CUSTOMERNAME]");CustName=row.getExpressionValue( "row["CUSTOMERNAME"]");
if( CustName.indexOf("Mini") != -1 ) countOfMinis += 1;". at
org.eclipse.birt.report.engine.executor.ExecutionContext.eva luate(ExecutionContext.java:556)
at
org.eclipse.birt.report.engine.executor.ExecutionContext.eva luate(ExecutionContext.java:528)
at
org.eclipse.birt.report.engine.script.internal.ScriptExecuto r.handleJSInternal(ScriptExecutor.java:66)
at
org.eclipse.birt.report.engine.script.internal.ScriptExecuto r.handleJS(ScriptExecutor.java:50)
at
org.eclipse.birt.report.engine.script.internal.DataItemScrip tExecutor.handleOnCreate(DataItemScriptExecutor.java:52)
at
org.eclipse.birt.report.engine.executor.DataItemExecutor.exe cute(DataItemExecutor.java:119)
at
org.eclipse.birt.report.engine.internal.executor.l18n.Locali zedReportItemExecutor.execute(LocalizedReportItemExecutor.ja va:35)
at
org.eclipse.birt.report.engine.layout.html.HTMLBlockStacking LM.layoutChildren(HTMLBlockStackingLM.java:63)
at
org.eclipse.birt.report.engine.layout.html.HTMLAbstractLM.la yout(HTMLAbstractLM.java:159)
at
org.eclipse.birt.report.engine.layout.html.HTMLInlineStackin gLM.resumeLayout(HTMLInlineStackingLM.java:94)
at
org.eclipse.birt.report.engine.layout.html.HTMLInlineStackin gLM.layoutChildren(HTMLInlineStackingLM.java:138)
at
org.eclipse.birt.report.engine.layout.html.HTMLAbstractLM.la yout(HTMLAbstractLM.java:159)
at
org.eclipse.birt.report.engine.layout.html.HTMLRowLM.layout( HTMLRowLM.java:30)
at
org.eclipse.birt.report.engine.layout.html.HTMLBlockStacking LM.layoutChildren(HTMLBlockStackingLM.java:68)
at
org.eclipse.birt.report.engine.layout.html.HTMLTableBandLM.l ayoutChildren(HTMLTableBandLM.java:67)
at
org.eclipse.birt.report.engine.layout.html.HTMLAbstractLM.la yout(HTMLAbstractLM.java:159)
at
org.eclipse.birt.report.engine.layout.html.HTMLBlockStacking LM.layoutChildren(HTMLBlockStackingLM.java:68)
at
org.eclipse.birt.report.engine.layout.html.HTMLTableLM.layou tChildren(HTMLTableLM.java:74)
at
org.eclipse.birt.report.engine.layout.html.HTMLAbstractLM.la yout(HTMLAbstractLM.java:159)
at
org.eclipse.birt.report.engine.layout.html.HTMLPageLM.layout Children(HTMLPageLM.java:139)
at
org.eclipse.birt.report.engine.layout.html.HTMLPageLM.layout (HTMLPageLM.java: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 (RunAndRenderTask.java:194)
at
org.eclipse.birt.report.service.ReportEngineService.runAndRe nderReport(Unknown
Source) at
org.eclipse.birt.report.service.ReportEngineService.runAndRe nderReport(Unknown
Source) at
org.eclipse.birt.report.service.BirtViewerReportService.runA ndRenderReport(Unknown
Source) at
org.eclipse.birt.report.service.actionhandler.BirtRunAndRend erActionHandler.__execute(Unknown
Source) at
org.eclipse.birt.report.service.actionhandler.AbstractBaseAc tionHandler.execute(Unknown
Source) at
org.eclipse.birt.report.presentation.aggregation.layout.Engi neFragment.doService(Unknown
Source) at
org.eclipse.birt.report.presentation.aggregation.AbstractBas eFragment.service(Unknown
Source) at
org.eclipse.birt.report.servlet.BirtEngineServlet.__doGet(Un known
Source) at
org.eclipse.birt.report.servlet.BaseReportEngineServlet.doGe t(Unknown
Source) at javax.servlet.http.HttpServlet.service(HttpServlet.java:740)
at
org.apache.axis.transport.http.AxisServletBase.service(AxisS ervletBase.java:327)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853) at
org.apache.catalina.core.ApplicationFilterChain.internalDoFi lter(ApplicationFilterChain.java:247)
at
org.apache.catalina.core.ApplicationFilterChain.doFilter(App licationFilterChain.java:193)
at
org.apache.catalina.core.StandardWrapperValve.invoke(Standar dWrapperValve.java:256)
at
org.apache.catalina.core.StandardPipeline$StandardPipelineVa lveContext.invokeNext(StandardPipeline.java:643)
at
org.apache.catalina.core.StandardPipeline.invoke(StandardPip eline.java:480)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase. java:995)
at
org.apache.catalina.core.StandardContextValve.invoke(Standar dContextValve.java:191)
at
org.apache.catalina.core.StandardPipeline$StandardPipelineVa lveContext.invokeNext(StandardPipeline.java:643)
at
org.apache.catalina.valves.CertificatesValve.invoke(Certific atesValve.java:246)
at
org.apache.catalina.core.StandardPipeline$StandardPipelineVa lveContext.invokeNext(StandardPipeline.java:641)
at
org.apache.catalina.core.StandardPipeline.invoke(StandardPip eline.java:480)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase. java:995)
at
org.apache.catalina.core.StandardContext.invoke(StandardCont ext.java:2422)
at
org.apache.catalina.core.StandardHostValve.invoke(StandardHo stValve.java:180)
at
org.apache.catalina.core.StandardPipeline$StandardPipelineVa lveContext.invokeNext(StandardPipeline.java:643)
at
org.apache.catalina.valves.ErrorDispatcherValve.invoke(Error DispatcherValve.java:171)
at
org.apache.catalina.core.StandardPipeline$StandardPipelineVa lveContext.invokeNext(StandardPipeline.java:641)
at
org.eclipse.tomcat.internal.EclipseErrorReportValve.invoke(E clipseErrorReportValve.java:153)
at
org.apache.catalina.core.StandardPipeline$StandardPipelineVa lveContext.invokeNext(StandardPipeline.java:641)
at
org.apache.catalina.core.StandardPipeline.invoke(StandardPip eline.java:480)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase. java:995)
at
org.apache.catalina.core.StandardEngineValve.invoke(Standard EngineValve.java:174)
at
org.apache.catalina.core.StandardPipeline$StandardPipelineVa lveContext.invokeNext(StandardPipeline.java:643)
at
org.apache.catalina.core.StandardPipeline.invoke(StandardPip eline.java:480)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase. java:995)
at
org.apache.coyote.tomcat4.CoyoteAdapter.service(CoyoteAdapte r.java:199)
at
org.apache.coyote.http11.Http11Processor.process(Http11Proce ssor.java:828)
at
org.apache.coyote.http11.Http11Protocol$Http11ConnectionHand ler.processConnection(Http11Protocol.java:700)
at
org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndp oint.java:584)
at
org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.ru n(ThreadPool.java:683)
at java.lang.Thread.run(Unknown Source)Caused by:
org.mozilla.javascript.EvaluatorException: missing ) after argument list
(<inline>#4) at
org.mozilla.javascript.DefaultErrorReporter.runtimeError(Def aultErrorReporter.java:95)
at
org.mozilla.javascript.DefaultErrorReporter.error(DefaultErr orReporter.java:82)
at org.mozilla.javascript.Parser.addError(Parser.java:120) at
org.mozilla.javascript.Parser.reportError(Parser.java:126) at
org.mozilla.javascript.Parser.mustMatchToken(Parser.java:212 ) at
org.mozilla.javascript.Parser.argumentList(Parser.java:1595) at
org.mozilla.javascript.Parser.memberExprTail(Parser.java:172 4) at
org.mozilla.javascript.Parser.memberExpr(Parser.java:1640) at
org.mozilla.javascript.Parser.unaryExpr(Parser.java:1500) at
org.mozilla.javascript.Parser.mulExpr(Parser.java:1429) at
org.mozilla.javascript.Parser.addExpr(Parser.java:1410) at
org.mozilla.javascript.Parser.shiftExpr(Parser.java:1390) at
org.mozilla.javascript.Parser.relExpr(Parser.java:1364) at
org.mozilla.javascript.Parser.eqExpr(Parser.java:1320) at
org.mozilla.javascript.Parser.bitAndExpr(Parser.java:1309) at
org.mozilla.javascript.Parser.bitXorExpr(Parser.java:1298) at
org.mozilla.javascript.Parser.bitOrExpr(Parser.java:1287) at
org.mozilla.javascript.Parser.andExpr(Parser.java:1275) at
org.mozilla.javascript.Parser.orExpr(Parser.java:1263) at
org.mozilla.javascript.Parser.condExpr(Parser.java:1246) at
org.mozilla.javascript.Parser.assignExpr(Parser.java:1228) at
org.mozilla.javascript.Parser.assignExpr(Parser.java:1234) at
org.mozilla.javascript.Parser.expr(Parser.java:1217) at
org.mozilla.javascript.Parser.statementHelper(Parser.java:11 04) at
org.mozilla.javascript.Parser.statement(Parser.java:616) at
org.mozilla.javascript.Parser.parse(Parser.java:347) at
org.mozilla.javascript.Parser.parse(Parser.java:287) at
org.mozilla.javascript.Context.compileImpl(Context.java:2349 ) at
org.mozilla.javascript.Context.compileString(Context.java:13 72) at
org.mozilla.javascript.Context.compileString(Context.java:13 61) at
org.eclipse.birt.core.script.ScriptContext.eval(ScriptContex t.java:221)
at
org.eclipse.birt.report.engine.executor.ExecutionContext.eva luate(ExecutionContext.java:549)
.... 65 more


Listing 1


Original example output
-------------------------
Customer Phone Contact
Alpha Cognac


Oct 26, 2006 11:37 AM

------------------------------------------------------------ --------------------

The following items have errors:


Data (id = 23):
- There are errors evaluating script "row=this.getRowData();
CustName=row.getExpressionValue("row[CUSTOMERNAME]");
if( CustName.indexOf("Mini") != -1 )
countOfMinis += 1;".
Error.ScriptEvaluationError ( 122 time(s) )
detail : org.eclipse.birt.report.engine.api.EngineException: There are
errors evaluating script
"row=this.getRowData();CustName=row.getExpressionValue("row[CUSTOMERNAME] ");
if( CustName.indexOf("Mini") != -1 ) countOfMinis += 1;". at
org.eclipse.birt.report.engine.executor.ExecutionContext.eva luate(ExecutionContext.java:556)
at
org.eclipse.birt.report.engine.executor.ExecutionContext.eva luate(ExecutionContext.java:528)
at
org.eclipse.birt.report.engine.script.internal.ScriptExecuto r.handleJSInternal(ScriptExecutor.java:66)
at
org.eclipse.birt.report.engine.script.internal.ScriptExecuto r.handleJS(ScriptExecutor.java:50)
at
org.eclipse.birt.report.engine.script.internal.DataItemScrip tExecutor.handleOnCreate(DataItemScriptExecutor.java:52)
at
org.eclipse.birt.report.engine.executor.DataItemExecutor.exe cute(DataItemExecutor.java:119)
at
org.eclipse.birt.report.engine.internal.executor.l18n.Locali zedReportItemExecutor.execute(LocalizedReportItemExecutor.ja va:35)
at
org.eclipse.birt.report.engine.layout.html.HTMLBlockStacking LM.layoutChildren(HTMLBlockStackingLM.java:63)
at
org.eclipse.birt.report.engine.layout.html.HTMLAbstractLM.la yout(HTMLAbstractLM.java:159)
at
org.eclipse.birt.report.engine.layout.html.HTMLInlineStackin gLM.resumeLayout(HTMLInlineStackingLM.java:94)
at
org.eclipse.birt.report.engine.layout.html.HTMLInlineStackin gLM.layoutChildren(HTMLInlineStackingLM.java:138)
at
org.eclipse.birt.report.engine.layout.html.HTMLAbstractLM.la yout(HTMLAbstractLM.java:159)
at
org.eclipse.birt.report.engine.layout.html.HTMLRowLM.layout( HTMLRowLM.java:30)
at
org.eclipse.birt.report.engine.layout.html.HTMLBlockStacking LM.layoutChildren(HTMLBlockStackingLM.java:68)
at
org.eclipse.birt.report.engine.layout.html.HTMLTableBandLM.l ayoutChildren(HTMLTableBandLM.java:67)
at
org.eclipse.birt.report.engine.layout.html.HTMLAbstractLM.la yout(HTMLAbstractLM.java:159)
at
org.eclipse.birt.report.engine.layout.html.HTMLBlockStacking LM.layoutChildren(HTMLBlockStackingLM.java:68)
at
org.eclipse.birt.report.engine.layout.html.HTMLTableLM.layou tChildren(HTMLTableLM.java:74)
at
org.eclipse.birt.report.engine.layout.html.HTMLAbstractLM.la yout(HTMLAbstractLM.java:159)
at
org.eclipse.birt.report.engine.layout.html.HTMLPageLM.layout Children(HTMLPageLM.java:139)
at
org.eclipse.birt.report.engine.layout.html.HTMLPageLM.layout (HTMLPageLM.java: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 (RunAndRenderTask.java:194)
at
org.eclipse.birt.report.service.ReportEngineService.runAndRe nderReport(Unknown
Source) at
org.eclipse.birt.report.service.ReportEngineService.runAndRe nderReport(Unknown
Source) at
org.eclipse.birt.report.service.BirtViewerReportService.runA ndRenderReport(Unknown
Source) at
org.eclipse.birt.report.service.actionhandler.BirtRunAndRend erActionHandler.__execute(Unknown
Source) at
org.eclipse.birt.report.service.actionhandler.AbstractBaseAc tionHandler.execute(Unknown
Source) at
org.eclipse.birt.report.presentation.aggregation.layout.Engi neFragment.doService(Unknown
Source) at
org.eclipse.birt.report.presentation.aggregation.AbstractBas eFragment.service(Unknown
Source) at
org.eclipse.birt.report.servlet.BirtEngineServlet.__doGet(Un known
Source) at
org.eclipse.birt.report.servlet.BaseReportEngineServlet.doGe t(Unknown
Source) at javax.servlet.http.HttpServlet.service(HttpServlet.java:740)
at
org.apache.axis.transport.http.AxisServletBase.service(AxisS ervletBase.java:327)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853) at
org.apache.catalina.core.ApplicationFilterChain.internalDoFi lter(ApplicationFilterChain.java:247)
at
org.apache.catalina.core.ApplicationFilterChain.doFilter(App licationFilterChain.java:193)
at
org.apache.catalina.core.StandardWrapperValve.invoke(Standar dWrapperValve.java:256)
at
org.apache.catalina.core.StandardPipeline$StandardPipelineVa lveContext.invokeNext(StandardPipeline.java:643)
at
org.apache.catalina.core.StandardPipeline.invoke(StandardPip eline.java:480)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase. java:995)
at
org.apache.catalina.core.StandardContextValve.invoke(Standar dContextValve.java:191)
at
org.apache.catalina.core.StandardPipeline$StandardPipelineVa lveContext.invokeNext(StandardPipeline.java:643)
at
org.apache.catalina.valves.CertificatesValve.invoke(Certific atesValve.java:246)
at
org.apache.catalina.core.StandardPipeline$StandardPipelineVa lveContext.invokeNext(StandardPipeline.java:641)
at
org.apache.catalina.core.StandardPipeline.invoke(StandardPip eline.java:480)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase. java:995)
at
org.apache.catalina.core.StandardContext.invoke(StandardCont ext.java:2422)
at
org.apache.catalina.core.StandardHostValve.invoke(StandardHo stValve.java:180)
at
org.apache.catalina.core.StandardPipeline$StandardPipelineVa lveContext.invokeNext(StandardPipeline.java:643)
at
org.apache.catalina.valves.ErrorDispatcherValve.invoke(Error DispatcherValve.java:171)
at
org.apache.catalina.core.StandardPipeline$StandardPipelineVa lveContext.invokeNext(StandardPipeline.java:641)
at
org.eclipse.tomcat.internal.EclipseErrorReportValve.invoke(E clipseErrorReportValve.java:153)
at
org.apache.catalina.core.StandardPipeline$StandardPipelineVa lveContext.invokeNext(StandardPipeline.java:641)
at
org.apache.catalina.core.StandardPipeline.invoke(StandardPip eline.java:480)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase. java:995)
at
org.apache.catalina.core.StandardEngineValve.invoke(Standard EngineValve.java:174)
at
org.apache.catalina.core.StandardPipeline$StandardPipelineVa lveContext.invokeNext(StandardPipeline.java:643)
at
org.apache.catalina.core.StandardPipeline.invoke(StandardPip eline.java:480)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase. java:995)
at
org.apache.coyote.tomcat4.CoyoteAdapter.service(CoyoteAdapte r.java:199)
at
org.apache.coyote.http11.Http11Processor.process(Http11Proce ssor.java:828)
at
org.apache.coyote.http11.Http11Protocol$Http11ConnectionHand ler.processConnection(Http11Protocol.java:700)
at
org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndp oint.java:584)
at
org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.ru n(ThreadPool.java:683)
at java.lang.Thread.run(Unknown Source)Caused by:
org.mozilla.javascript.EcmaError: TypeError: Cannot call method
"indexOf" of null (<inline>#3) at
org.mozilla.javascript.ScriptRuntime.constructError(ScriptRu ntime.java:3240)
at
org.mozilla.javascript.ScriptRuntime.constructError(ScriptRu ntime.java:3230)
at
org.mozilla.javascript.ScriptRuntime.typeError(ScriptRuntime .java:3246)
at
org.mozilla.javascript.ScriptRuntime.typeError2(ScriptRuntim e.java:3265)
at
org.mozilla.javascript.ScriptRuntime.undefCallError(ScriptRu ntime.java:3284)
at
org.mozilla.javascript.ScriptRuntime.getPropFunctionAndThis( ScriptRuntime.java:1965)
at org.mozilla.javascript.gen.c11._c0(<inline>:3) at
org.mozilla.javascript.gen.c11.call(<inline>) at
org.mozilla.javascript.ContextFactory.doTopCall(ContextFacto ry.java:304)
at
org.mozilla.javascript.ScriptRuntime.doTopCall(ScriptRuntime .java:2769)
at org.mozilla.javascript.gen.c11.call(<inline>) at
org.mozilla.javascript.gen.c11.exec(<inline>) at
org.eclipse.birt.core.script.ScriptContext.eval(ScriptContex t.java:224)
at
org.eclipse.birt.report.engine.executor.ExecutionContext.eva luate(ExecutionContext.java:549)
.... 65 more



--------------050507090807010508070107
Content-Type: text/xml;
name="customers.rptdesign"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline;
filename="customers.rptdesign"

<?xml version="1.0" encoding="UTF-8"?>
<!-- Written by Eclipse BIRT 2.0 -->
<report xmlns="http://www.eclipse.org/birt/2005/design" version="3.2.6" id="1">
<property name="createdBy">Eclipse BIRT Designer Version 2.1.1.v20060922-1058 Build &lt;20060926-0959></property>
<property name="units">in</property>
<property name="comments">Copyright (c) 2006 &lt;&lt;Your Company Name here>></property>
<method name="afterFactory"><![CDATA[importPackage( Packages.javax.swing );
frame = new JFrame( "Count of Minis = " + countOfMinis );
frame.setBounds( 310, 220, 300, 20 );
frame.show( );]]></method>
<data-sources>
<oda-data-source extensionID="org.eclipse.birt.report.data.oda.jdbc" name="Data Source" id="4">
<property name="odaDriverClass">org.eclipse.birt.report.data.oda.sampledb.Driver </property>
<property name="odaURL">jdbc:classicmodels:sampledb</property>
<property name="odaUser">ClassicModels</property>
</oda-data-source>
</data-sources>
<data-sets>
<oda-data-set extensionID="org.eclipse.birt.report.data.oda.jdbc.JdbcSelectDataSet " name="customers" id="5">
<structure name="cachedMetaData">
<list-property name="resultSet">
<structure>
<property name="position">1</property>
<property name="name">CUSTOMERNAME</property>
<property name="dataType">string</property>
</structure>
<structure>
<property name="position">2</property>
<property name="name">CONTACTLASTNAME</property>
<property name="dataType">string</property>
</structure>
<structure>
<property name="position">3</property>
<property name="name">CONTACTFIRSTNAME</property>
<property name="dataType">string</property>
</structure>
<structure>
<property name="position">4</property>
<property name="name">PHONE</property>
<property name="dataType">string</property>
</structure>
</list-property>
</structure>
<property name="dataSource">Data Source</property>
<list-property name="resultSet">
<structure>
<property name="position">1</property>
<property name="name">CUSTOMERNAME</property>
<property name="nativeName">CUSTOMERNAME</property>
<property name="dataType">string</property>
<property name="nativeDataType">12</property>
</structure>
<structure>
<property name="position">2</property>
<property name="name">CONTACTLASTNAME</property>
<property name="nativeName">CONTACTLASTNAME</property>
<property name="dataType">string</property>
<property name="nativeDataType">12</property>
</structure>
<structure>
<property name="position">3</property>
<property name="name">CONTACTFIRSTNAME</property>
<property name="nativeName">CONTACTFIRSTNAME</property>
<property name="dataType">string</property>
<property name="nativeDataType">12</property>
</structure>
<structure>
<property name="position">4</property>
<property name="name">PHONE</property>
<property name="nativeName">PHONE</property>
<property name="dataType">string</property>
<property name="nativeDataType">12</property>
</structure>
</list-property>
<property name="queryText">select customerName,
contactLastName,
contactFirstName,
phone
from Customers </property>
<xml-property name="designerValues"><![CDATA[<?xml version="1.0" encoding="UTF-8"?>
<model:DesignValues xmlns:design="http://www.eclipse.org/datatools/connectivity/oda/design" xmlns:model="http://www.eclipse.org/birt/report/model/adapter/odaModel">
<Version>1.0</Version>
<design:ResultSets derivedMetaData="true">
<design:resultSetDefinitions>
<design:resultSetColumns>
<design:resultColumnDefinitions>
<design:attributes>
<design:name>CUSTOMERNAME</design:name>
<design:position>1</design:position>
<design:nativeDataTypeCode>12</design:nativeDataTypeCode>
<design:precision>50</design:precision>
<design:scale>0</design:scale>
<design:nullability>Nullable</design:nullability>
</design:attributes>
<design:usageHints>
<design:label>CUSTOMERNAME</design:label>
<design:formattingHints>
<design:displaySize>50</design:displaySize>
</design:formattingHints>
</design:usageHints>
</design:resultColumnDefinitions>
<design:resultColumnDefinitions>
<design:attributes>
<design:name>CONTACTLASTNAME</design:name>
<design:position>2</design:position>
<design:nativeDataTypeCode>12</design:nativeDataTypeCode>
<design:precision>50</design:precision>
<design:scale>0</design:scale>
<design:nullability>Nullable</design:nullability>
</design:attributes>
<design:usageHints>
<design:label>CONTACTLASTNAME</design:label>
<design:formattingHints>
<design:displaySize>50</design:displaySize>
</design:formattingHints>
</design:usageHints>
</design:resultColumnDefinitions>
<design:resultColumnDefinitions>
<design:attributes>
<design:name>CONTACTFIRSTNAME</design:name>
<design:position>3</design:position>
<design:nativeDataTypeCode>12</design:nativeDataTypeCode>
<design:precision>50</design:precision>
<design:scale>0</design:scale>
<design:nullability>Nullable</design:nullability>
</design:attributes>
<design:usageHints>
<design:label>CONTACTFIRSTNAME</design:label>
<design:formattingHints>
<design:displaySize>50</design:displaySize>
</design:formattingHints>
</design:usageHints>
</design:resultColumnDefinitions>
<design:resultColumnDefinitions>
<design:attributes>
<design:name>PHONE</design:name>
<design:position>4</design:position>
<design:nativeDataTypeCode>12</design:nativeDataTypeCode>
<design:precision>50</design:precision>
<design:scale>0</design:scale>
<design:nullability>Nullable</design:nullability>
</design:attributes>
<design:usageHints>
<design:label>PHONE</design:label>
<design:formattingHints>
<design:displaySize>50</design:displaySize>
</design:formattingHints>
</design:usageHints>
</design:resultColumnDefinitions>
</design:resultSetColumns>
</design:resultSetDefinitions>
<design:resultSetDefinitions>
<design:resultSetColumns>
<design:resultColumnDefinitions>
<design:attributes>
<design:name>CUSTOMERNAME</design:name>
<design:position>1</design:position>
<design:nativeDataTypeCode>12</design:nativeDataTypeCode>
</design:attributes>
</design:resultColumnDefinitions>
<design:resultColumnDefinitions>
<design:attributes>
<design:name>CONTACTLASTNAME</design:name>
<design:position>2</design:position>
<design:nativeDataTypeCode>12</design:nativeDataTypeCode>
</design:attributes>
</design:resultColumnDefinitions>
<design:resultColumnDefinitions>
<design:attributes>
<design:name>CONTACTFIRSTNAME</design:name>
<design:position>3</design:position>
<design:nativeDataTypeCode>12</design:nativeDataTypeCode>
</design:attributes>
</design:resultColumnDefinitions>
<design:resultColumnDefinitions>
<design:attributes>
<design:name>PHONE</design:name>
<design:position>4</design:position>
<design:nativeDataTypeCode>12</design:nativeDataTypeCode>
</design:attributes>
</design:resultColumnDefinitions>
</design:resultSetColumns>
</design:resultSetDefinitions>
</design:ResultSets>
</model:DesignValues>]]></xml-property>
</oda-data-set>
</data-sets>
<page-setup>
<simple-master-page name="Simple MasterPage" id="2">
<page-footer>
<text id="3">
<property name="contentType">html</property>
<text-property name="content"><![CDATA[<value-of>new Date()</value-of>]]></text-property>
</text>
</page-footer>
</simple-master-page>
</page-setup>
<body>
<text id="29">
<property name="contentType">html</property>
<text-property name="content"><![CDATA[<CENTER><B><span style="font-size: larger">
Customer List
</B></span><BR>
<FONT size="small">For internal use only</FONT><BR><BR>
Report generated on <VALUE-OF>new Date( )</VALUE-OF>
</CENTER><BR><BR>
]]></text-property>
</text>
<table id="6">
<property name="width">100%</property>
<property name="dataSet">customers</property>
<list-property name="boundDataColumns">
<structure>
<property name="name">CUSTOMERNAME</property>
<expression name="expression">dataSetRow["CUSTOMERNAME"]</expression >
<property name="dataType">string</property>
</structure>
<structure>
<property name="name">PHONE</property>
<expression name="expression">dataSetRow["PHONE"]</expression>
<property name="dataType">string</property>
</structure>
<structure>
<property name="name">CONTACTFIRSTNAME</property>
<expression name="expression">dataSetRow["CONTACTFIRSTNAME"]+" "+row["CONTACTLASTNAME"]</expression>
<property name="dataType">string</property>
</structure>
<structure>
<property name="name">CONTACTLASTNAME</property>
<expression name="expression">dataSetRow["CONTACTLASTNAME"]</expression >
<property name="dataType">string</property>
</structure>
</list-property>
<method name="onCreate"><![CDATA[countOfMinis = 0;]]></method>
<list-property name="sort">
<structure>
<expression name="key">row["CUSTOMERNAME"].toUpperCase()</expression >
<property name="direction">asc</property>
</structure>
</list-property>
<column id="19"/>
<column id="20"/>
<column id="21"/>
<header>
<row id="7">
<cell id="8">
<label id="22">
<text-property name="text">Customer</text-property>
</label>
</cell>
<cell id="9">
<label id="24">
<text-property name="text">Phone</text-property>
</label>
</cell>
<cell id="10">
<label id="26">
<text-property name="text">Contact</text-property>
</label>
</cell>
</row>
</header>
<detail>
<row id="11">
<cell id="12">
<data id="23">
<property name="paddingTop">12pt</property>
<method name="onCreate"><![CDATA[row=this.getRowData();
CustName = this.getRowData().getColumnValue(0);
//CustName = row.getColumnValue("row[CUSTOMERNAME]");
//CustName=row.getExpressionValue("row["CUSTOMERNAME"]");
if( CustName.indexOf("Mini") != -1 )
countOfMinis += 1;]]></method>
<property name="resultSetColumn">CUSTOMERNAME</property>
</data>
</cell>
<cell id="13">
<data id="25">
<property name="paddingTop">12pt</property>
<property name="resultSetColumn">PHONE</property>
</data>
</cell>
<cell id="14">
<data id="27">
<property name="paddingTop">12pt</property>
<property name="resultSetColumn">CONTACTFIRSTNAME</property>
</data>
</cell>
</row>
</detail>
<footer>
<row id="15">
<cell id="16"/>
<cell id="17"/>
<cell id="18"/>
</row>
</footer>
</table>
</body>
</report>

--------------050507090807010508070107--
Re: Tutorial 5, Field Guide to BIRT, problem running the "Writing an event handler in JavaScrip [message #198097 is a reply to message #197914] Fri, 27 October 2006 22:50 Go to previous messageGo to next message
Jane Tatchell is currently offline Jane TatchellFriend
Messages: 32
Registered: July 2009
Member
Thanks for your detailed comments. The online help, including the tutorials,
is based on release 2.1.0 of BIRT. There have been some changes between
2.1.0 and 2.1.1, which may be causing some of the problems that you're
experiencing. I'll look at these issues and let you know the outcome as soon
as I can. I'm not personally familiar with Tutorial 5, but I'll pass your
comments onto my colleague who wrote the tutorial. Unfortunately, he is
taking some vacation right now, but he'll be back in the office next
Thursday.

--
Jane Tatchell
BIRT documentation lead


"Susan Cline" <home4slc@pacbell.net> wrote in message
news:ehre4j$fjv$1@utils.eclipse.org...
> Hi,
>
> Im having trouble with on of the tutorials in the on-line help, "Field
> Guide to BIRT", and wondering if it is a bug or pilot error. I will be
> happy to enter a bugzilla if it is a bug if someone can take a moment to
> help with this.
>
> I completed tutorial 1 and have a sample report based on completing this
> tutorial. In tutorial 5, Writing an event handler in JavaScript, I've
> found a problem when following the instructions.
>
> In Task 2 of Tutorial 5, Create and initialize a counter in
> Table.onCreate() method,
> the screen shot, Figure 22-5 shows the row called row["CUSTOMERNAME"],
> but I believe this should be dataSetRow["CUSTOMERNAME"]. (This is
> irrelevant to the problem later, but I believe the screen shot is
> incorrect?)
>
> Also, in Task 3, step 4 here is the JavaScript:
>
> CustName=row.getExpressionValue( "row[CUSTOMERNAME]" );
>
> The output I get when running the report only shows the first column's
> first row (cell 1) correctly (listing 1 below), and I'm getting a stack
> trace, and the CountOfMinis never increments. Here is the interesting
> part of the stack trace:
>
> (ThreadPool.java:683) at java.lang.Thread.run(Unknown Source)Caused by:
> org.mozilla.javascript.EcmaError: TypeError: Cannot call method
> "indexOf" of null (<inline>#3)
>
> So I changed the above line of JavaScript to this:
>
> CustName=row.getExpressionValue("row["CUSTOMERNAME"]");
>
> and I get all of the output, the CountOfMinis still does not increment
> and I get this stack trace (Listing 2);
>
> (ThreadPool.java:683) at java.lang.Thread.run(Unknown Source)Caused by:
> org.mozilla.javascript.EvaluatorException: missing ) after argument list
> (<inline>#4) at
> org.mozilla.javascript.DefaultErrorReporter.runtimeError(Def aultErrorReporter.java:95)
> at
>
>
> I looked at the 2.1.1 version of the source and noticed that
> getExpressionValue has been decremented. So I tried to modify the
> example to what I thought would be correct and I still have problems.
> I modified the code snippet for Task 3 to be this:
>
> CustName = this.getRowData().getColumnValue(0);
>
> Now I get the correct CountOfMinis, and no stack trace, but only the
> first cell appears.
>
> Can someone tell me the correct JavaScript to run this example? I've
> also attached my report design file.
>
> Regards,
>
> Susan
> ************************************************************ ***************
>
> Listing 2
>
> ------------------------------------------------------------ --------------------
>
> The following items have errors:
>
>
> Data (id = 23):
> - There are errors evaluating script "row=this.getRowData();
> //CustName = this.getRowData().getColumnValue(0);
> //countOfMinis = row.getColumnValue("row[CUSTOMERNAME]");
> CustName=row.getExpressionValue("row["CUSTOMERNAME"]");
> if( CustName.indexOf("Mini") != -1 )
> countOfMinis += 1;".
> Error.ScriptEvaluationError ( 122 time(s) )
> detail : org.eclipse.birt.report.engine.api.EngineException: There are
> errors evaluating script "row=this.getRowData();//CustName =
> this.getRowData().getColumnValue(0);//countOfMinis =
> row.getColumnValue("row[CUSTOMERNAME]");CustName=row.getExpressionValue( "row["CUSTOMERNAME"]");
> if( CustName.indexOf("Mini") != -1 ) countOfMinis += 1;". at
> org.eclipse.birt.report.engine.executor.ExecutionContext.eva luate(ExecutionContext.java:556)
> at
> org.eclipse.birt.report.engine.executor.ExecutionContext.eva luate(ExecutionContext.java:528)
> at
> org.eclipse.birt.report.engine.script.internal.ScriptExecuto r.handleJSInternal(ScriptExecutor.java:66)
> at
> org.eclipse.birt.report.engine.script.internal.ScriptExecuto r.handleJS(ScriptExecutor.java:50)
> at
> org.eclipse.birt.report.engine.script.internal.DataItemScrip tExecutor.handleOnCreate(DataItemScriptExecutor.java:52)
> at
> org.eclipse.birt.report.engine.executor.DataItemExecutor.exe cute(DataItemExecutor.java:119)
> at
> org.eclipse.birt.report.engine.internal.executor.l18n.Locali zedReportItemExecutor.execute(LocalizedReportItemExecutor.ja va:35)
> at
> org.eclipse.birt.report.engine.layout.html.HTMLBlockStacking LM.layoutChildren(HTMLBlockStackingLM.java:63)
> at
> org.eclipse.birt.report.engine.layout.html.HTMLAbstractLM.la yout(HTMLAbstractLM.java:159)
> at
> org.eclipse.birt.report.engine.layout.html.HTMLInlineStackin gLM.resumeLayout(HTMLInlineStackingLM.java:94)
> at
> org.eclipse.birt.report.engine.layout.html.HTMLInlineStackin gLM.layoutChildren(HTMLInlineStackingLM.java:138)
> at
> org.eclipse.birt.report.engine.layout.html.HTMLAbstractLM.la yout(HTMLAbstractLM.java:159)
> at
> org.eclipse.birt.report.engine.layout.html.HTMLRowLM.layout( HTMLRowLM.java:30)
> at
> org.eclipse.birt.report.engine.layout.html.HTMLBlockStacking LM.layoutChildren(HTMLBlockStackingLM.java:68)
> at
> org.eclipse.birt.report.engine.layout.html.HTMLTableBandLM.l ayoutChildren(HTMLTableBandLM.java:67)
> at
> org.eclipse.birt.report.engine.layout.html.HTMLAbstractLM.la yout(HTMLAbstractLM.java:159)
> at
> org.eclipse.birt.report.engine.layout.html.HTMLBlockStacking LM.layoutChildren(HTMLBlockStackingLM.java:68)
> at
> org.eclipse.birt.report.engine.layout.html.HTMLTableLM.layou tChildren(HTMLTableLM.java:74)
> at
> org.eclipse.birt.report.engine.layout.html.HTMLAbstractLM.la yout(HTMLAbstractLM.java:159)
> at
> org.eclipse.birt.report.engine.layout.html.HTMLPageLM.layout Children(HTMLPageLM.java:139)
> at
> org.eclipse.birt.report.engine.layout.html.HTMLPageLM.layout (HTMLPageLM.java: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 (RunAndRenderTask.java:194)
> at
> org.eclipse.birt.report.service.ReportEngineService.runAndRe nderReport(Unknown
> Source) at
> org.eclipse.birt.report.service.ReportEngineService.runAndRe nderReport(Unknown
> Source) at
> org.eclipse.birt.report.service.BirtViewerReportService.runA ndRenderReport(Unknown
> Source) at
> org.eclipse.birt.report.service.actionhandler.BirtRunAndRend erActionHandler.__execute(Unknown
> Source) at
> org.eclipse.birt.report.service.actionhandler.AbstractBaseAc tionHandler.execute(Unknown
> Source) at
> org.eclipse.birt.report.presentation.aggregation.layout.Engi neFragment.doService(Unknown
> Source) at
> org.eclipse.birt.report.presentation.aggregation.AbstractBas eFragment.service(Unknown
> Source) at
> org.eclipse.birt.report.servlet.BirtEngineServlet.__doGet(Un known
> Source) at
> org.eclipse.birt.report.servlet.BaseReportEngineServlet.doGe t(Unknown
> Source) at javax.servlet.http.HttpServlet.service(HttpServlet.java:740)
> at
> org.apache.axis.transport.http.AxisServletBase.service(AxisS ervletBase.java:327)
> at javax.servlet.http.HttpServlet.service(HttpServlet.java:853) at
> org.apache.catalina.core.ApplicationFilterChain.internalDoFi lter(ApplicationFilterChain.java:247)
> at
> org.apache.catalina.core.ApplicationFilterChain.doFilter(App licationFilterChain.java:193)
> at
> org.apache.catalina.core.StandardWrapperValve.invoke(Standar dWrapperValve.java:256)
> at
> org.apache.catalina.core.StandardPipeline$StandardPipelineVa lveContext.invokeNext(StandardPipeline.java:643)
> at
> org.apache.catalina.core.StandardPipeline.invoke(StandardPip eline.java:480)
> at org.apache.catalina.core.ContainerBase.invoke(ContainerBase. java:995)
> at
> org.apache.catalina.core.StandardContextValve.invoke(Standar dContextValve.java:191)
> at
> org.apache.catalina.core.StandardPipeline$StandardPipelineVa lveContext.invokeNext(StandardPipeline.java:643)
> at
> org.apache.catalina.valves.CertificatesValve.invoke(Certific atesValve.java:246)
> at
> org.apache.catalina.core.StandardPipeline$StandardPipelineVa lveContext.invokeNext(StandardPipeline.java:641)
> at
> org.apache.catalina.core.StandardPipeline.invoke(StandardPip eline.java:480)
> at org.apache.catalina.core.ContainerBase.invoke(ContainerBase. java:995)
> at
> org.apache.catalina.core.StandardContext.invoke(StandardCont ext.java:2422)
> at
> org.apache.catalina.core.StandardHostValve.invoke(StandardHo stValve.java:180)
> at
> org.apache.catalina.core.StandardPipeline$StandardPipelineVa lveContext.invokeNext(StandardPipeline.java:643)
> at
> org.apache.catalina.valves.ErrorDispatcherValve.invoke(Error DispatcherValve.java:171)
> at
> org.apache.catalina.core.StandardPipeline$StandardPipelineVa lveContext.invokeNext(StandardPipeline.java:641)
> at
> org.eclipse.tomcat.internal.EclipseErrorReportValve.invoke(E clipseErrorReportValve.java:153)
> at
> org.apache.catalina.core.StandardPipeline$StandardPipelineVa lveContext.invokeNext(StandardPipeline.java:641)
> at
> org.apache.catalina.core.StandardPipeline.invoke(StandardPip eline.java:480)
> at org.apache.catalina.core.ContainerBase.invoke(ContainerBase. java:995)
> at
> org.apache.catalina.core.StandardEngineValve.invoke(Standard EngineValve.java:174)
> at
> org.apache.catalina.core.StandardPipeline$StandardPipelineVa lveContext.invokeNext(StandardPipeline.java:643)
> at
> org.apache.catalina.core.StandardPipeline.invoke(StandardPip eline.java:480)
> at org.apache.catalina.core.ContainerBase.invoke(ContainerBase. java:995)
> at
> org.apache.coyote.tomcat4.CoyoteAdapter.service(CoyoteAdapte r.java:199)
> at
> org.apache.coyote.http11.Http11Processor.process(Http11Proce ssor.java:828)
> at
> org.apache.coyote.http11.Http11Protocol$Http11ConnectionHand ler.processConnection(Http11Protocol.java:700)
> at
> org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndp oint.java:584)
> at
> org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.ru n(ThreadPool.java:683)
> at java.lang.Thread.run(Unknown Source)Caused by:
> org.mozilla.javascript.EvaluatorException: missing ) after argument list
> (<inline>#4) at
> org.mozilla.javascript.DefaultErrorReporter.runtimeError(Def aultErrorReporter.java:95)
> at
> org.mozilla.javascript.DefaultErrorReporter.error(DefaultErr orReporter.java:82)
> at org.mozilla.javascript.Parser.addError(Parser.java:120) at
> org.mozilla.javascript.Parser.reportError(Parser.java:126) at
> org.mozilla.javascript.Parser.mustMatchToken(Parser.java:212 ) at
> org.mozilla.javascript.Parser.argumentList(Parser.java:1595) at
> org.mozilla.javascript.Parser.memberExprTail(Parser.java:172 4) at
> org.mozilla.javascript.Parser.memberExpr(Parser.java:1640) at
> org.mozilla.javascript.Parser.unaryExpr(Parser.java:1500) at
> org.mozilla.javascript.Parser.mulExpr(Parser.java:1429) at
> org.mozilla.javascript.Parser.addExpr(Parser.java:1410) at
> org.mozilla.javascript.Parser.shiftExpr(Parser.java:1390) at
> org.mozilla.javascript.Parser.relExpr(Parser.java:1364) at
> org.mozilla.javascript.Parser.eqExpr(Parser.java:1320) at
> org.mozilla.javascript.Parser.bitAndExpr(Parser.java:1309) at
> org.mozilla.javascript.Parser.bitXorExpr(Parser.java:1298) at
> org.mozilla.javascript.Parser.bitOrExpr(Parser.java:1287) at
> org.mozilla.javascript.Parser.andExpr(Parser.java:1275) at
> org.mozilla.javascript.Parser.orExpr(Parser.java:1263) at
> org.mozilla.javascript.Parser.condExpr(Parser.java:1246) at
> org.mozilla.javascript.Parser.assignExpr(Parser.java:1228) at
> org.mozilla.javascript.Parser.assignExpr(Parser.java:1234) at
> org.mozilla.javascript.Parser.expr(Parser.java:1217) at
> org.mozilla.javascript.Parser.statementHelper(Parser.java:11 04) at
> org.mozilla.javascript.Parser.statement(Parser.java:616) at
> org.mozilla.javascript.Parser.parse(Parser.java:347) at
> org.mozilla.javascript.Parser.parse(Parser.java:287) at
> org.mozilla.javascript.Context.compileImpl(Context.java:2349 ) at
> org.mozilla.javascript.Context.compileString(Context.java:13 72) at
> org.mozilla.javascript.Context.compileString(Context.java:13 61) at
> org.eclipse.birt.core.script.ScriptContext.eval(ScriptContex t.java:221)
> at
> org.eclipse.birt.report.engine.executor.ExecutionContext.eva luate(ExecutionContext.java:549)
> ... 65 more
>
>
> Listing 1
>
>
> Original example output
> -------------------------
> Customer Phone Contact
> Alpha Cognac
>
>
> Oct 26, 2006 11:37 AM
>
> ------------------------------------------------------------ --------------------
>
> The following items have errors:
>
>
> Data (id = 23):
> - There are errors evaluating script "row=this.getRowData();
> CustName=row.getExpressionValue("row[CUSTOMERNAME]");
> if( CustName.indexOf("Mini") != -1 )
> countOfMinis += 1;".
> Error.ScriptEvaluationError ( 122 time(s) )
> detail : org.eclipse.birt.report.engine.api.EngineException: There are
> errors evaluating script
> "row=this.getRowData();CustName=row.getExpressionValue("row[CUSTOMERNAME] ");
> if( CustName.indexOf("Mini") != -1 ) countOfMinis += 1;". at
> org.eclipse.birt.report.engine.executor.ExecutionContext.eva luate(ExecutionContext.java:556)
> at
> org.eclipse.birt.report.engine.executor.ExecutionContext.eva luate(ExecutionContext.java:528)
> at
> org.eclipse.birt.report.engine.script.internal.ScriptExecuto r.handleJSInternal(ScriptExecutor.java:66)
> at
> org.eclipse.birt.report.engine.script.internal.ScriptExecuto r.handleJS(ScriptExecutor.java:50)
> at
> org.eclipse.birt.report.engine.script.internal.DataItemScrip tExecutor.handleOnCreate(DataItemScriptExecutor.java:52)
> at
> org.eclipse.birt.report.engine.executor.DataItemExecutor.exe cute(DataItemExecutor.java:119)
> at
> org.eclipse.birt.report.engine.internal.executor.l18n.Locali zedReportItemExecutor.execute(LocalizedReportItemExecutor.ja va:35)
> at
> org.eclipse.birt.report.engine.layout.html.HTMLBlockStacking LM.layoutChildren(HTMLBlockStackingLM.java:63)
> at
> org.eclipse.birt.report.engine.layout.html.HTMLAbstractLM.la yout(HTMLAbstractLM.java:159)
> at
> org.eclipse.birt.report.engine.layout.html.HTMLInlineStackin gLM.resumeLayout(HTMLInlineStackingLM.java:94)
> at
> org.eclipse.birt.report.engine.layout.html.HTMLInlineStackin gLM.layoutChildren(HTMLInlineStackingLM.java:138)
> at
> org.eclipse.birt.report.engine.layout.html.HTMLAbstractLM.la yout(HTMLAbstractLM.java:159)
> at
> org.eclipse.birt.report.engine.layout.html.HTMLRowLM.layout( HTMLRowLM.java:30)
> at
> org.eclipse.birt.report.engine.layout.html.HTMLBlockStacking LM.layoutChildren(HTMLBlockStackingLM.java:68)
> at
> org.eclipse.birt.report.engine.layout.html.HTMLTableBandLM.l ayoutChildren(HTMLTableBandLM.java:67)
> at
> org.eclipse.birt.report.engine.layout.html.HTMLAbstractLM.la yout(HTMLAbstractLM.java:159)
> at
> org.eclipse.birt.report.engine.layout.html.HTMLBlockStacking LM.layoutChildren(HTMLBlockStackingLM.java:68)
> at
> org.eclipse.birt.report.engine.layout.html.HTMLTableLM.layou tChildren(HTMLTableLM.java:74)
> at
> org.eclipse.birt.report.engine.layout.html.HTMLAbstractLM.la yout(HTMLAbstractLM.java:159)
> at
> org.eclipse.birt.report.engine.layout.html.HTMLPageLM.layout Children(HTMLPageLM.java:139)
> at
> org.eclipse.birt.report.engine.layout.html.HTMLPageLM.layout (HTMLPageLM.java: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 (RunAndRenderTask.java:194)
> at
> org.eclipse.birt.report.service.ReportEngineService.runAndRe nderReport(Unknown
> Source) at
> org.eclipse.birt.report.service.ReportEngineService.runAndRe nderReport(Unknown
> Source) at
> org.eclipse.birt.report.service.BirtViewerReportService.runA ndRenderReport(Unknown
> Source) at
> org.eclipse.birt.report.service.actionhandler.BirtRunAndRend erActionHandler.__execute(Unknown
> Source) at
> org.eclipse.birt.report.service.actionhandler.AbstractBaseAc tionHandler.execute(Unknown
> Source) at
> org.eclipse.birt.report.presentation.aggregation.layout.Engi neFragment.doService(Unknown
> Source) at
> org.eclipse.birt.report.presentation.aggregation.AbstractBas eFragment.service(Unknown
> Source) at
> org.eclipse.birt.report.servlet.BirtEngineServlet.__doGet(Un known
> Source) at
> org.eclipse.birt.report.servlet.BaseReportEngineServlet.doGe t(Unknown
> Source) at javax.servlet.http.HttpServlet.service(HttpServlet.java:740)
> at
> org.apache.axis.transport.http.AxisServletBase.service(AxisS ervletBase.java:327)
> at javax.servlet.http.HttpServlet.service(HttpServlet.java:853) at
> org.apache.catalina.core.ApplicationFilterChain.internalDoFi lter(ApplicationFilterChain.java:247)
> at
> org.apache.catalina.core.ApplicationFilterChain.doFilter(App licationFilterChain.java:193)
> at
> org.apache.catalina.core.StandardWrapperValve.invoke(Standar dWrapperValve.java:256)
> at
> org.apache.catalina.core.StandardPipeline$StandardPipelineVa lveContext.invokeNext(StandardPipeline.java:643)
> at
> org.apache.catalina.core.StandardPipeline.invoke(StandardPip eline.java:480)
> at org.apache.catalina.core.ContainerBase.invoke(ContainerBase. java:995)
> at
> org.apache.catalina.core.StandardContextValve.invoke(Standar dContextValve.java:191)
> at
> org.apache.catalina.core.StandardPipeline$StandardPipelineVa lveContext.invokeNext(StandardPipeline.java:643)
> at
> org.apache.catalina.valves.CertificatesValve.invoke(Certific atesValve.java:246)
> at
> org.apache.catalina.core.StandardPipeline$StandardPipelineVa lveContext.invokeNext(StandardPipeline.java:641)
> at
> org.apache.catalina.core.StandardPipeline.invoke(StandardPip eline.java:480)
> at org.apache.catalina.core.ContainerBase.invoke(ContainerBase. java:995)
> at
> org.apache.catalina.core.StandardContext.invoke(StandardCont ext.java:2422)
> at
> org.apache.catalina.core.StandardHostValve.invoke(StandardHo stValve.java:180)
> at
> org.apache.catalina.core.StandardPipeline$StandardPipelineVa lveContext.invokeNext(StandardPipeline.java:643)
> at
> org.apache.catalina.valves.ErrorDispatcherValve.invoke(Error DispatcherValve.java:171)
> at
> org.apache.catalina.core.StandardPipeline$StandardPipelineVa lveContext.invokeNext(StandardPipeline.java:641)
> at
> org.eclipse.tomcat.internal.EclipseErrorReportValve.invoke(E clipseErrorReportValve.java:153)
> at
> org.apache.catalina.core.StandardPipeline$StandardPipelineVa lveContext.invokeNext(StandardPipeline.java:641)
> at
> org.apache.catalina.core.StandardPipeline.invoke(StandardPip eline.java:480)
> at org.apache.catalina.core.ContainerBase.invoke(ContainerBase. java:995)
> at
> org.apache.catalina.core.StandardEngineValve.invoke(Standard EngineValve.java:174)
> at
> org.apache.catalina.core.StandardPipeline$StandardPipelineVa lveContext.invokeNext(StandardPipeline.java:643)
> at
> org.apache.catalina.core.StandardPipeline.invoke(StandardPip eline.java:480)
> at org.apache.catalina.core.ContainerBase.invoke(ContainerBase. java:995)
> at
> org.apache.coyote.tomcat4.CoyoteAdapter.service(CoyoteAdapte r.java:199)
> at
> org.apache.coyote.http11.Http11Processor.process(Http11Proce ssor.java:828)
> at
> org.apache.coyote.http11.Http11Protocol$Http11ConnectionHand ler.processConnection(Http11Protocol.java:700)
> at
> org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndp oint.java:584)
> at
> org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.ru n(ThreadPool.java:683)
> at java.lang.Thread.run(Unknown Source)Caused by:
> org.mozilla.javascript.EcmaError: TypeError: Cannot call method
> "indexOf" of null (<inline>#3) at
> org.mozilla.javascript.ScriptRuntime.constructError(ScriptRu ntime.java:3240)
> at
> org.mozilla.javascript.ScriptRuntime.constructError(ScriptRu ntime.java:3230)
> at
> org.mozilla.javascript.ScriptRuntime.typeError(ScriptRuntime .java:3246)
> at
> org.mozilla.javascript.ScriptRuntime.typeError2(ScriptRuntim e.java:3265)
> at
> org.mozilla.javascript.ScriptRuntime.undefCallError(ScriptRu ntime.java:3284)
> at
> org.mozilla.javascript.ScriptRuntime.getPropFunctionAndThis( ScriptRuntime.java:1965)
> at org.mozilla.javascript.gen.c11._c0(<inline>:3) at
> org.mozilla.javascript.gen.c11.call(<inline>) at
> org.mozilla.javascript.ContextFactory.doTopCall(ContextFacto ry.java:304)
> at
> org.mozilla.javascript.ScriptRuntime.doTopCall(ScriptRuntime .java:2769)
> at org.mozilla.javascript.gen.c11.call(<inline>) at
> org.mozilla.javascript.gen.c11.exec(<inline>) at
> org.eclipse.birt.core.script.ScriptContext.eval(ScriptContex t.java:224)
> at
> org.eclipse.birt.report.engine.executor.ExecutionContext.eva luate(ExecutionContext.java:549)
> ... 65 more
>
>
>


------------------------------------------------------------ --------------------


> <?xml version="1.0" encoding="UTF-8"?>
> <!-- Written by Eclipse BIRT 2.0 -->
> <report xmlns="http://www.eclipse.org/birt/2005/design" version="3.2.6"
> id="1">
> <property name="createdBy">Eclipse BIRT Designer Version
> 2.1.1.v20060922-1058 Build &lt;20060926-0959></property>
> <property name="units">in</property>
> <property name="comments">Copyright (c) 2006 &lt;&lt;Your Company Name
> here>></property>
> <method name="afterFactory"><![CDATA[importPackage(
> Packages.javax.swing );
> frame = new JFrame( "Count of Minis = " + countOfMinis );
> frame.setBounds( 310, 220, 300, 20 );
> frame.show( );]]></method>
> <data-sources>
> <oda-data-source
> extensionID="org.eclipse.birt.report.data.oda.jdbc" name="Data Source"
> id="4">
> <property
> name="odaDriverClass">org.eclipse.birt.report.data.oda.sampledb.Driver </property>
> <property name="odaURL">jdbc:classicmodels:sampledb</property>
> <property name="odaUser">ClassicModels</property>
> </oda-data-source>
> </data-sources>
> <data-sets>
> <oda-data-set
> extensionID="org.eclipse.birt.report.data.oda.jdbc.JdbcSelectDataSet "
> name="customers" id="5">
> <structure name="cachedMetaData">
> <list-property name="resultSet">
> <structure>
> <property name="position">1</property>
> <property name="name">CUSTOMERNAME</property>
> <property name="dataType">string</property>
> </structure>
> <structure>
> <property name="position">2</property>
> <property name="name">CONTACTLASTNAME</property>
> <property name="dataType">string</property>
> </structure>
> <structure>
> <property name="position">3</property>
> <property name="name">CONTACTFIRSTNAME</property>
> <property name="dataType">string</property>
> </structure>
> <structure>
> <property name="position">4</property>
> <property name="name">PHONE</property>
> <property name="dataType">string</property>
> </structure>
> </list-property>
> </structure>
> <property name="dataSource">Data Source</property>
> <list-property name="resultSet">
> <structure>
> <property name="position">1</property>
> <property name="name">CUSTOMERNAME</property>
> <property name="nativeName">CUSTOMERNAME</property>
> <property name="dataType">string</property>
> <property name="nativeDataType">12</property>
> </structure>
> <structure>
> <property name="position">2</property>
> <property name="name">CONTACTLASTNAME</property>
> <property name="nativeName">CONTACTLASTNAME</property>
> <property name="dataType">string</property>
> <property name="nativeDataType">12</property>
> </structure>
> <structure>
> <property name="position">3</property>
> <property name="name">CONTACTFIRSTNAME</property>
> <property name="nativeName">CONTACTFIRSTNAME</property>
> <property name="dataType">string</property>
> <property name="nativeDataType">12</property>
> </structure>
> <structure>
> <property name="position">4</property>
> <property name="name">PHONE</property>
> <property name="nativeName">PHONE</property>
> <property name="dataType">string</property>
> <property name="nativeDataType">12</property>
> </structure>
> </list-property>
> <property name="queryText">select customerName,
> contactLastName,
> contactFirstName,
> phone
> from Customers </property>
> <xml-property name="designerValues"><![CDATA[<?xml
> version="1.0" encoding="UTF-8"?>
> <model:DesignValues
> xmlns:design="http://www.eclipse.org/datatools/connectivity/oda/design"
> xmlns:model="http://www.eclipse.org/birt/report/model/adapter/odaModel">
> <Version>1.0</Version>
> <design:ResultSets derivedMetaData="true">
> <design:resultSetDefinitions>
> <design:resultSetColumns>
> <design:resultColumnDefinitions>
> <design:attributes>
> <design:name>CUSTOMERNAME</design:name>
> <design:position>1</design:position>
> <design:nativeDataTypeCode>12</design:nativeDataTypeCode>
> <design:precision>50</design:precision>
> <design:scale>0</design:scale>
> <design:nullability>Nullable</design:nullability>
> </design:attributes>
> <design:usageHints>
> <design:label>CUSTOMERNAME</design:label>
> <design:formattingHints>
> <design:displaySize>50</design:displaySize>
> </design:formattingHints>
> </design:usageHints>
> </design:resultColumnDefinitions>
> <design:resultColumnDefinitions>
> <design:attributes>
> <design:name>CONTACTLASTNAME</design:name>
> <design:position>2</design:position>
> <design:nativeDataTypeCode>12</design:nativeDataTypeCode>
> <design:precision>50</design:precision>
> <design:scale>0</design:scale>
> <design:nullability>Nullable</design:nullability>
> </design:attributes>
> <design:usageHints>
> <design:label>CONTACTLASTNAME</design:label>
> <design:formattingHints>
> <design:displaySize>50</design:displaySize>
> </design:formattingHints>
> </design:usageHints>
> </design:resultColumnDefinitions>
> <design:resultColumnDefinitions>
> <design:attributes>
> <design:name>CONTACTFIRSTNAME</design:name>
> <design:position>3</design:position>
> <design:nativeDataTypeCode>12</design:nativeDataTypeCode>
> <design:precision>50</design:precision>
> <design:scale>0</design:scale>
> <design:nullability>Nullable</design:nullability>
> </design:attributes>
> <design:usageHints>
> <design:label>CONTACTFIRSTNAME</design:label>
> <design:formattingHints>
> <design:displaySize>50</design:displaySize>
> </design:formattingHints>
> </design:usageHints>
> </design:resultColumnDefinitions>
> <design:resultColumnDefinitions>
> <design:attributes>
> <design:name>PHONE</design:name>
> <design:position>4</design:position>
> <design:nativeDataTypeCode>12</design:nativeDataTypeCode>
> <design:precision>50</design:precision>
> <design:scale>0</design:scale>
> <design:nullability>Nullable</design:nullability>
> </design:attributes>
> <design:usageHints>
> <design:label>PHONE</design:label>
> <design:formattingHints>
> <design:displaySize>50</design:displaySize>
> </design:formattingHints>
> </design:usageHints>
> </design:resultColumnDefinitions>
> </design:resultSetColumns>
> </design:resultSetDefinitions>
> <design:resultSetDefinitions>
> <design:resultSetColumns>
> <design:resultColumnDefinitions>
> <design:attributes>
> <design:name>CUSTOMERNAME</design:name>
> <design:position>1</design:position>
> <design:nativeDataTypeCode>12</design:nativeDataTypeCode>
> </design:attributes>
> </design:resultColumnDefinitions>
> <design:resultColumnDefinitions>
> <design:attributes>
> <design:name>CONTACTLASTNAME</design:name>
> <design:position>2</design:position>
> <design:nativeDataTypeCode>12</design:nativeDataTypeCode>
> </design:attributes>
> </design:resultColumnDefinitions>
> <design:resultColumnDefinitions>
> <design:attributes>
> <design:name>CONTACTFIRSTNAME</design:name>
> <design:position>3</design:position>
> <design:nativeDataTypeCode>12</design:nativeDataTypeCode>
> </design:attributes>
> </design:resultColumnDefinitions>
> <design:resultColumnDefinitions>
> <design:attributes>
> <design:name>PHONE</design:name>
> <design:position>4</design:position>
> <design:nativeDataTypeCode>12</design:nativeDataTypeCode>
> </design:attributes>
> </design:resultColumnDefinitions>
> </design:resultSetColumns>
> </design:resultSetDefinitions>
> </design:ResultSets>
> </model:DesignValues>]]></xml-property>
> </oda-data-set>
> </data-sets>
> <page-setup>
> <simple-master-page name="Simple MasterPage" id="2">
> <page-footer>
> <text id="3">
> <property name="contentType">html</property>
> <text-property name="content"><![CDATA[<value-of>new
> Date()</value-of>]]></text-property>
> </text>
> </page-footer>
> </simple-master-page>
> </page-setup>
> <body>
> <text id="29">
> <property name="contentType">html</property>
> <text-property name="content"><![CDATA[<CENTER><B><span
> style="font-size: larger">
> Customer List
> </B></span><BR>
> <FONT size="small">For internal use only</FONT><BR><BR>
> Report generated on <VALUE-OF>new Date( )</VALUE-OF>
> </CENTER><BR><BR>
> ]]></text-property>
> </text>
> <table id="6">
> <property name="width">100%</property>
> <property name="dataSet">customers</property>
> <list-property name="boundDataColumns">
> <structure>
> <property name="name">CUSTOMERNAME</property>
> <expression
> name="expression">dataSetRow["CUSTOMERNAME"]</expression >
> <property name="dataType">string</property>
> </structure>
> <structure>
> <property name="name">PHONE</property>
> <expression
> name="expression">dataSetRow["PHONE"]</expression>
> <property name="dataType">string</property>
> </structure>
> <structure>
> <property name="name">CONTACTFIRSTNAME</property>
> <expression
> name="expression">dataSetRow["CONTACTFIRSTNAME"]+"
> "+row["CONTACTLASTNAME"]</expression>
> <property name="dataType">string</property>
> </structure>
> <structure>
> <property name="name">CONTACTLASTNAME</property>
> <expression
> name="expression">dataSetRow["CONTACTLASTNAME"]</expression >
> <property name="dataType">string</property>
> </structure>
> </list-property>
> <method name="onCreate"><![CDATA[countOfMinis = 0;]]></method>
> <list-property name="sort">
> <structure>
> <expression
> name="key">row["CUSTOMERNAME"].toUpperCase()</expression >
> <property name="direction">asc</property>
> </structure>
> </list-property>
> <column id="19"/>
> <column id="20"/>
> <column id="21"/>
> <header>
> <row id="7">
> <cell id="8">
> <label id="22">
> <text-property
> name="text">Customer</text-property>
> </label>
> </cell>
> <cell id="9">
> <label id="24">
> <text-property
> name="text">Phone</text-property>
> </label>
> </cell>
> <cell id="10">
> <label id="26">
> <text-property
> name="text">Contact</text-property>
> </label>
> </cell>
> </row>
> </header>
> <detail>
> <row id="11">
> <cell id="12">
> <data id="23">
> <property name="paddingTop">12pt</property>
> <method
> name="onCreate"><![CDATA[row=this.getRowData();
> CustName = this.getRowData().getColumnValue(0);
> //CustName = row.getColumnValue("row[CUSTOMERNAME]");
> //CustName=row.getExpressionValue("row["CUSTOMERNAME"]");
> if( CustName.indexOf("Mini") != -1 )
> countOfMinis += 1;]]></method>
> <property
> name="resultSetColumn">CUSTOMERNAME</property>
> </data>
> </cell>
> <cell id="13">
> <data id="25">
> <property name="paddingTop">12pt</property>
> <property
> name="resultSetColumn">PHONE</property>
> </data>
> </cell>
> <cell id="14">
> <data id="27">
> <property name="paddingTop">12pt</property>
> <property
> name="resultSetColumn">CONTACTFIRSTNAME</property>
> </data>
> </cell>
> </row>
> </detail>
> <footer>
> <row id="15">
> <cell id="16"/>
> <cell id="17"/>
> <cell id="18"/>
> </row>
> </footer>
> </table>
> </body>
> </report>
>
Re: Tutorial 5, Field Guide to BIRT, problem running the "Writing an event handler in JavaScrip [message #198115 is a reply to message #198097] Fri, 27 October 2006 23:55 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: home4slc.pacbell.net

Thanks Jane.

In the meantime I'll see if I can figure out the correct usage and post
a corrected example.

Regards,

Susan

Jane Tatchell wrote:

> Thanks for your detailed comments. The online help, including the tutorials,
> is based on release 2.1.0 of BIRT. There have been some changes between
> 2.1.0 and 2.1.1, which may be causing some of the problems that you're
> experiencing. I'll look at these issues and let you know the outcome as soon
> as I can. I'm not personally familiar with Tutorial 5, but I'll pass your
> comments onto my colleague who wrote the tutorial. Unfortunately, he is
> taking some vacation right now, but he'll be back in the office next
> Thursday.
>
Re: Tutorial 5, Field Guide to BIRT, problem running the "Writing an event handler in JavaScrip [message #198379 is a reply to message #198097] Mon, 30 October 2006 22:19 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: home4slc.pacbell.net

Hi,

I played with this example some more and I'm thinking there might be a
bug with the way the word "row" is parsed.

For Task 3 of Tutorial 5 here is the script that is supposed to be typed
into the onCreate method of the Script tab for the detailed row
CUSTOMERNAME.

row=this.getRowData();
CustName = row.getExpressionValue("row[CUSTOMERNAME]");
if (CustName.indexOf("Mini") != -1)
countOfMinis +=1;

As I mentioned in my previous email, running this script causes this
partial listing of the stack trace:
(This is the primary source: org.mozilla.javascript.EcmaError:
TypeError: Cannot call method "indexOf" of null (<inline>#3) at
org.mozilla.javascript.ScriptRuntime.constructError(ScriptRu ntime.java:3240)
)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^
..... lots of stuff cut out.....

at
org.apache.coyote.http11.Http11Processor.process(Http11Proce ssor.java:828)
at
org.apache.coyote.http11.Http11Protocol$Http11ConnectionHand ler.processConnection(Http11Protocol.java:700)
at
org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndp oint.java:584)
at
org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.ru n(ThreadPool.java:683)
at java.lang.Thread.run(Thread.java:534)Caused by:
org.mozilla.javascript.EcmaError: TypeError: Cannot call method
"indexOf" of null (<inline>#3) at
org.mozilla.javascript.ScriptRuntime.constructError(ScriptRu ntime.java:3240)
at
org.mozilla.javascript.ScriptRuntime.constructError(ScriptRu ntime.java:3230)
at
org.mozilla.javascript.ScriptRuntime.typeError(ScriptRuntime .java:3246)
at
org.mozilla.javascript.ScriptRuntime.typeError2(ScriptRuntim e.java:3265)
at
org.mozilla.javascript.ScriptRuntime.undefCallError(ScriptRu ntime.java:3284)
at
org.mozilla.javascript.ScriptRuntime.getPropFunctionAndThis( ScriptRuntime.java:1965)
at org.mozilla.javascript.gen.c183._c0(<inline>:3) at
org.mozilla.javascript.gen.c183.call(<inline>) at
org.mozilla.javascript.ContextFactory.doTopCall(ContextFacto ry.java:304)
at
org.mozilla.javascript.ScriptRuntime.doTopCall(ScriptRuntime .java:2769)
at org.mozilla.javascript.gen.c183.call(<inline>) at
org.mozilla.javascript.gen.c183.exec(<inline>) at
org.eclipse.birt.core.script.ScriptContext.eval(ScriptContex t.java:224)
at
org.eclipse.birt.report.engine.executor.ExecutionContext.eva luate(ExecutionContext.java:549)
.... 65 more

^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
However, if you change the example to use this for the onCreate method:

myrow=this.getRowData();
CustName = myrow.getExpressionValue("row[CUSTOMERNAME]");
if (CustName.indexOf("Mini") != -1)
countOfMinis +=1;

The example executes correctly. Also, I tried this for the script;

CustName = this.getRowData().getExpressionValue("row[CUSTOMERNAME]");
if (CustName.indexOf("Mini") != -1)
countOfMinis +=1;

and it works fine as well.

So it appears like there might be some kind of parsing problem on the
word "row" in the first example. It looks like the word "row" in the
getExpressionValue method is being confused with the JavaScript
variable, row.

I'll enter a bugzilla bug for this. Also, I would be happy to help
correct this tutorial example. Other than providing a correct example
(until the bug is fixed, if it is a bug), is there another methodology
for providing information to correct documentation examples? For
instance, should I log a bugzilla for documentation issues as well?

I believe I found an error in another document on the web site that I
would like to report and provide a corrected example for as well.

Regards,

Susan

Jane Tatchell wrote:

> Thanks for your detailed comments. The online help, including the tutorials,
> is based on release 2.1.0 of BIRT. There have been some changes between
> 2.1.0 and 2.1.1, which may be causing some of the problems that you're
> experiencing. I'll look at these issues and let you know the outcome as soon
> as I can. I'm not personally familiar with Tutorial 5, but I'll pass your
> comments onto my colleague who wrote the tutorial. Unfortunately, he is
> taking some vacation right now, but he'll be back in the office next
> Thursday.
>
Re: Tutorial 5, Field Guide to BIRT, problem running the "Writing an event handler in JavaScrip [message #199041 is a reply to message #198379] Fri, 03 November 2006 20:03 Go to previous messageGo to next message
Don French is currently offline Don FrenchFriend
Messages: 2
Registered: July 2009
Junior Member
You are correct that there is a problem with the variable name, "row". It
appears that "row" is now a prohibited variable name.

There is another problem with the tutorial, however. It is no longer
possible to access a variable within one handler if that varialbe was
created in different event handler. Well, there is a way, but the tutorial
tries to use the old method. The variable "countOfMinis" must be a
serializable Java object and the methods that save and retrieve the
serializable object are reportContext.setPersistentGlobalVariable( ) and
reportContext.getPersistentGlobalVariable( ). The correct code for the three
event handlers is:



Table.onCreate:

countOfMinis = new Packages.java.lang.Integer("1");

reportContext.setPersistentGlobalVariable("cmKey", countOfMinis);





Row.onCreate:

countOfMinis = reportContext.getPersistentGlobalVariable("cmKey");

row_Data = this.getRowData();

CustName = row_Data.getExpressionValue( "row[CUSTOMERNAME]" );

if(CustName.indexOf("Mini") != -1){

mCount = countOfMinis.intValue();

mCount += 1;

countOfMinis = new Packages.java.lang.Integer(mCount);

reportContext.setPersistentGlobalVariable("cmKey", countOfMinis);

}



ReportDesign.afterFactory:

importPackage( Packages.javax.swing );

countOfMinis =
reportContext.getPersistentGlobalVariable("cmKey").intValue();

frame = new JFrame( "Count of Minis = " + countOfMinis );

frame.setBounds( 310, 220, 300, 20 );

frame.show( );

(Thanks to Jason Weathersby for helping me debug this.)

"Susan Cline" <home4slc@pacbell.net> wrote in message
news:ei5toa$l2m$1@utils.eclipse.org...
> Hi,
>
> I played with this example some more and I'm thinking there might be a bug
> with the way the word "row" is parsed.
>
> For Task 3 of Tutorial 5 here is the script that is supposed to be typed
> into the onCreate method of the Script tab for the detailed row
> CUSTOMERNAME.
>
> row=this.getRowData();
> CustName = row.getExpressionValue("row[CUSTOMERNAME]");
> if (CustName.indexOf("Mini") != -1)
> countOfMinis +=1;
>
> As I mentioned in my previous email, running this script causes this
> partial listing of the stack trace:
> (This is the primary source: org.mozilla.javascript.EcmaError: TypeError:
> Cannot call method "indexOf" of null (<inline>#3) at
> org.mozilla.javascript.ScriptRuntime.constructError(ScriptRu ntime.java:3240)
> )
> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^
> .... lots of stuff cut out.....
>
> at
> org.apache.coyote.http11.Http11Processor.process(Http11Proce ssor.java:828)
> at
> org.apache.coyote.http11.Http11Protocol$Http11ConnectionHand ler.processConnection(Http11Protocol.java:700)
> at
> org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndp oint.java:584)
> at
> org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.ru n(ThreadPool.java:683)
> at java.lang.Thread.run(Thread.java:534)Caused by:
> org.mozilla.javascript.EcmaError: TypeError: Cannot call method "indexOf"
> of null (<inline>#3) at
> org.mozilla.javascript.ScriptRuntime.constructError(ScriptRu ntime.java:3240)
> at
> org.mozilla.javascript.ScriptRuntime.constructError(ScriptRu ntime.java:3230)
> at org.mozilla.javascript.ScriptRuntime.typeError(ScriptRuntime .java:3246)
> at
> org.mozilla.javascript.ScriptRuntime.typeError2(ScriptRuntim e.java:3265)
> at
> org.mozilla.javascript.ScriptRuntime.undefCallError(ScriptRu ntime.java:3284)
> at
> org.mozilla.javascript.ScriptRuntime.getPropFunctionAndThis( ScriptRuntime.java:1965)
> at org.mozilla.javascript.gen.c183._c0(<inline>:3) at
> org.mozilla.javascript.gen.c183.call(<inline>) at
> org.mozilla.javascript.ContextFactory.doTopCall(ContextFacto ry.java:304)
> at org.mozilla.javascript.ScriptRuntime.doTopCall(ScriptRuntime .java:2769)
> at org.mozilla.javascript.gen.c183.call(<inline>) at
> org.mozilla.javascript.gen.c183.exec(<inline>) at
> org.eclipse.birt.core.script.ScriptContext.eval(ScriptContex t.java:224) at
> org.eclipse.birt.report.engine.executor.ExecutionContext.eva luate(ExecutionContext.java:549)
> ... 65 more
>
> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
> However, if you change the example to use this for the onCreate method:
>
> myrow=this.getRowData();
> CustName = myrow.getExpressionValue("row[CUSTOMERNAME]");
> if (CustName.indexOf("Mini") != -1)
> countOfMinis +=1;
>
> The example executes correctly. Also, I tried this for the script;
>
> CustName = this.getRowData().getExpressionValue("row[CUSTOMERNAME]");
> if (CustName.indexOf("Mini") != -1)
> countOfMinis +=1;
>
> and it works fine as well.
>
> So it appears like there might be some kind of parsing problem on the word
> "row" in the first example. It looks like the word "row" in the
> getExpressionValue method is being confused with the JavaScript variable,
> row.
>
> I'll enter a bugzilla bug for this. Also, I would be happy to help
> correct this tutorial example. Other than providing a correct example
> (until the bug is fixed, if it is a bug), is there another methodology for
> providing information to correct documentation examples? For instance,
> should I log a bugzilla for documentation issues as well?
>
> I believe I found an error in another document on the web site that I
> would like to report and provide a corrected example for as well.
>
> Regards,
>
> Susan
>
> Jane Tatchell wrote:
>
>> Thanks for your detailed comments. The online help, including the
>> tutorials, is based on release 2.1.0 of BIRT. There have been some
>> changes between 2.1.0 and 2.1.1, which may be causing some of the
>> problems that you're experiencing. I'll look at these issues and let you
>> know the outcome as soon as I can. I'm not personally familiar with
>> Tutorial 5, but I'll pass your comments onto my colleague who wrote the
>> tutorial. Unfortunately, he is taking some vacation right now, but he'll
>> be back in the office next Thursday.
>>
Re: Tutorial 5, Field Guide to BIRT, problem running the "Writing an event handler in JavaScrip [message #199126 is a reply to message #199041] Fri, 03 November 2006 23:42 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: home4slc.pacbell.net

Hi Don,

Thanks for your help with this. I logged a bug for the problem when
using the word "row" in the JavaScript titled "Report Engine error
parsing word "row" in evaluating JavaScript", bugzilla 162817.

https://bugs.eclipse.org/bugs/show_bug.cgi?id=162817

This was changed to a doc bug so the tutorial example could be
corrected. However, I made a comment to this bug that I thought that
BIRT should somehow throw a better error message when the word "row" is
encountered in a script and used as a variable.

So I'm not sure if I should log a new bugzilla for the tutorial
correction or the existing bugzilla # should be used. No one has
commented on the bug yet, so I'm not sure what is going on with it.

Thanks,

Susan

Don French wrote:

> You are correct that there is a problem with the variable name, "row". It
> appears that "row" is now a prohibited variable name.
>
> There is another problem with the tutorial, however. It is no longer
> possible to access a variable within one handler if that varialbe was
> created in different event handler. Well, there is a way, but the tutorial
> tries to use the old method. The variable "countOfMinis" must be a
> serializable Java object and the methods that save and retrieve the
> serializable object are reportContext.setPersistentGlobalVariable( ) and
> reportContext.getPersistentGlobalVariable( ). The correct code for the three
> event handlers is:
>
>
>
> Table.onCreate:
>
> countOfMinis = new Packages.java.lang.Integer("1");
>
> reportContext.setPersistentGlobalVariable("cmKey", countOfMinis);
>
>
>
>
>
> Row.onCreate:
>
> countOfMinis = reportContext.getPersistentGlobalVariable("cmKey");
>
> row_Data = this.getRowData();
>
> CustName = row_Data.getExpressionValue( "row[CUSTOMERNAME]" );
>
> if(CustName.indexOf("Mini") != -1){
>
> mCount = countOfMinis.intValue();
>
> mCount += 1;
>
> countOfMinis = new Packages.java.lang.Integer(mCount);
>
> reportContext.setPersistentGlobalVariable("cmKey", countOfMinis);
>
> }
>
>
>
> ReportDesign.afterFactory:
>
> importPackage( Packages.javax.swing );
>
> countOfMinis =
> reportContext.getPersistentGlobalVariable("cmKey").intValue();
>
> frame = new JFrame( "Count of Minis = " + countOfMinis );
>
> frame.setBounds( 310, 220, 300, 20 );
>
> frame.show( );
>
> (Thanks to Jason Weathersby for helping me debug this.)
>
> "Susan Cline" <home4slc@pacbell.net> wrote in message
> news:ei5toa$l2m$1@utils.eclipse.org...
>
>>Hi,
>>
>>I played with this example some more and I'm thinking there might be a bug
>>with the way the word "row" is parsed.
>>
>>For Task 3 of Tutorial 5 here is the script that is supposed to be typed
>>into the onCreate method of the Script tab for the detailed row
>>CUSTOMERNAME.
>>
>>row=this.getRowData();
>>CustName = row.getExpressionValue("row[CUSTOMERNAME]");
>>if (CustName.indexOf("Mini") != -1)
>>countOfMinis +=1;
>>
>>As I mentioned in my previous email, running this script causes this
>>partial listing of the stack trace:
>>(This is the primary source: org.mozilla.javascript.EcmaError: TypeError:
>>Cannot call method "indexOf" of null (<inline>#3) at
>> org.mozilla.javascript.ScriptRuntime.constructError(ScriptRu ntime.java:3240)
>> )
>> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^
>>.... lots of stuff cut out.....
>>
>>at
>> org.apache.coyote.http11.Http11Processor.process(Http11Proce ssor.java:828)
>>at
>> org.apache.coyote.http11.Http11Protocol$Http11ConnectionHand ler.processConnection(Http11Protocol.java:700)
>>at
>> org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndp oint.java:584)
>>at
>> org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.ru n(ThreadPool.java:683)
>>at java.lang.Thread.run(Thread.java:534)Caused by:
>>org.mozilla.javascript.EcmaError: TypeError: Cannot call method "indexOf"
>>of null (<inline>#3) at
>> org.mozilla.javascript.ScriptRuntime.constructError(ScriptRu ntime.java:3240)
>>at
>> org.mozilla.javascript.ScriptRuntime.constructError(ScriptRu ntime.java:3230)
>>at org.mozilla.javascript.ScriptRuntime.typeError(ScriptRuntime .java:3246)
>>at
>> org.mozilla.javascript.ScriptRuntime.typeError2(ScriptRuntim e.java:3265)
>>at
>> org.mozilla.javascript.ScriptRuntime.undefCallError(ScriptRu ntime.java:3284)
>>at
>> org.mozilla.javascript.ScriptRuntime.getPropFunctionAndThis( ScriptRuntime.java:1965)
>>at org.mozilla.javascript.gen.c183._c0(<inline>:3) at
>>org.mozilla.javascript.gen.c183.call(<inline>) at
>> org.mozilla.javascript.ContextFactory.doTopCall(ContextFacto ry.java:304)
>>at org.mozilla.javascript.ScriptRuntime.doTopCall(ScriptRuntime .java:2769)
>>at org.mozilla.javascript.gen.c183.call(<inline>) at
>>org.mozilla.javascript.gen.c183.exec(<inline>) at
>> org.eclipse.birt.core.script.ScriptContext.eval(ScriptContex t.java:224) at
>> org.eclipse.birt.report.engine.executor.ExecutionContext.eva luate(ExecutionContext.java:549)
>>... 65 more
>>
>> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
>>However, if you change the example to use this for the onCreate method:
>>
>>myrow=this.getRowData();
>>CustName = myrow.getExpressionValue("row[CUSTOMERNAME]");
>>if (CustName.indexOf("Mini") != -1)
>>countOfMinis +=1;
>>
>>The example executes correctly. Also, I tried this for the script;
>>
>>CustName = this.getRowData().getExpressionValue("row[CUSTOMERNAME]");
>>if (CustName.indexOf("Mini") != -1)
>>countOfMinis +=1;
>>
>>and it works fine as well.
>>
>>So it appears like there might be some kind of parsing problem on the word
>>"row" in the first example. It looks like the word "row" in the
>>getExpressionValue method is being confused with the JavaScript variable,
>>row.
>>
>>I'll enter a bugzilla bug for this. Also, I would be happy to help
>>correct this tutorial example. Other than providing a correct example
>>(until the bug is fixed, if it is a bug), is there another methodology for
>>providing information to correct documentation examples? For instance,
>>should I log a bugzilla for documentation issues as well?
>>
>>I believe I found an error in another document on the web site that I
>>would like to report and provide a corrected example for as well.
>>
>>Regards,
>>
>>Susan
>>
>>Jane Tatchell wrote:
>>
>>
>>>Thanks for your detailed comments. The online help, including the
>>>tutorials, is based on release 2.1.0 of BIRT. There have been some
>>>changes between 2.1.0 and 2.1.1, which may be causing some of the
>>>problems that you're experiencing. I'll look at these issues and let you
>>>know the outcome as soon as I can. I'm not personally familiar with
>>>Tutorial 5, but I'll pass your comments onto my colleague who wrote the
>>>tutorial. Unfortunately, he is taking some vacation right now, but he'll
>>>be back in the office next Thursday.
>>>
>
>
>
Re: Tutorial 5, Field Guide to BIRT, problem running the "Writing an event handler in JavaScrip [message #199810 is a reply to message #199041] Wed, 08 November 2006 10:24 Go to previous messageGo to next message
maria baldassarri is currently offline maria baldassarriFriend
Messages: 19
Registered: July 2009
Junior Member
Hi Don,
you say:
"It is no longer
possible to access a variable within one handler if that variable was
created in different event handler."

In which version of BIRT this is true?
I'm using 2.1.1 and still works

Thanks Maria Baldassarri
Re: Tutorial 5, Field Guide to BIRT, problem running the "Writing an event handler in JavaScrip [message #201257 is a reply to message #199126] Thu, 16 November 2006 16:29 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: home4slc.pacbell.net

Bug 162817 has been changed to a Report Designer bug. Should I log a
bugzilla for the tutorial?

Thanks,

Susan

Susan Cline wrote:

> Hi Don,
>
> Thanks for your help with this. I logged a bug for the problem when
> using the word "row" in the JavaScript titled "Report Engine error
> parsing word "row" in evaluating JavaScript", bugzilla 162817.
>
> https://bugs.eclipse.org/bugs/show_bug.cgi?id=162817
>
> This was changed to a doc bug so the tutorial example could be
> corrected. However, I made a comment to this bug that I thought that
> BIRT should somehow throw a better error message when the word "row" is
> encountered in a script and used as a variable.
>
> So I'm not sure if I should log a new bugzilla for the tutorial
> correction or the existing bugzilla # should be used. No one has
> commented on the bug yet, so I'm not sure what is going on with it.
>
> Thanks,
>
> Susan
>
> Don French wrote:
>
>> You are correct that there is a problem with the variable name,
>> "row". It appears that "row" is now a prohibited variable name.
>>
>> There is another problem with the tutorial, however. It is no longer
>> possible to access a variable within one handler if that varialbe was
>> created in different event handler. Well, there is a way, but the
>> tutorial tries to use the old method. The variable "countOfMinis" must
>> be a serializable Java object and the methods that save and retrieve
>> the serializable object are reportContext.setPersistentGlobalVariable(
>> ) and reportContext.getPersistentGlobalVariable( ). The correct code
>> for the three event handlers is:
>>
>>
>>
>> Table.onCreate:
>>
>> countOfMinis = new Packages.java.lang.Integer("1");
>>
>> reportContext.setPersistentGlobalVariable("cmKey", countOfMinis);
>>
>>
>>
>>
>>
>> Row.onCreate:
>>
>> countOfMinis = reportContext.getPersistentGlobalVariable("cmKey");
>>
>> row_Data = this.getRowData();
>>
>> CustName = row_Data.getExpressionValue( "row[CUSTOMERNAME]" );
>>
>> if(CustName.indexOf("Mini") != -1){
>>
>> mCount = countOfMinis.intValue();
>>
>> mCount += 1;
>>
>> countOfMinis = new Packages.java.lang.Integer(mCount);
>>
>> reportContext.setPersistentGlobalVariable("cmKey", countOfMinis);
>>
>> }
>>
>>
>>
>> ReportDesign.afterFactory:
>>
>> importPackage( Packages.javax.swing );
>>
>> countOfMinis =
>> reportContext.getPersistentGlobalVariable("cmKey").intValue();
>>
>> frame = new JFrame( "Count of Minis = " + countOfMinis );
>>
>> frame.setBounds( 310, 220, 300, 20 );
>>
>> frame.show( );
>>
>> (Thanks to Jason Weathersby for helping me debug this.)
>>
>> "Susan Cline" <home4slc@pacbell.net> wrote in message
>> news:ei5toa$l2m$1@utils.eclipse.org...
>>
>>> Hi,
>>>
>>> I played with this example some more and I'm thinking there might be
>>> a bug with the way the word "row" is parsed.
>>>
>>> For Task 3 of Tutorial 5 here is the script that is supposed to be
>>> typed into the onCreate method of the Script tab for the detailed row
>>> CUSTOMERNAME.
>>>
>>> row=this.getRowData();
>>> CustName = row.getExpressionValue("row[CUSTOMERNAME]");
>>> if (CustName.indexOf("Mini") != -1)
>>> countOfMinis +=1;
>>>
>>> As I mentioned in my previous email, running this script causes this
>>> partial listing of the stack trace:
>>> (This is the primary source: org.mozilla.javascript.EcmaError:
>>> TypeError: Cannot call method "indexOf" of null (<inline>#3) at
>>> org.mozilla.javascript.ScriptRuntime.constructError(ScriptRu ntime.java:3240)
>>> )
>>> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^
>>>
>>> .... lots of stuff cut out.....
>>>
>>> at
>>> org.apache.coyote.http11.Http11Processor.process(Http11Proce ssor.java:828)
>>> at
>>> org.apache.coyote.http11.Http11Protocol$Http11ConnectionHand ler.processConnection(Http11Protocol.java:700)
>>> at
>>> org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndp oint.java:584)
>>> at
>>> org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.ru n(ThreadPool.java:683)
>>> at java.lang.Thread.run(Thread.java:534)Caused by:
>>> org.mozilla.javascript.EcmaError: TypeError: Cannot call method
>>> "indexOf" of null (<inline>#3) at
>>> org.mozilla.javascript.ScriptRuntime.constructError(ScriptRu ntime.java:3240)
>>> at
>>> org.mozilla.javascript.ScriptRuntime.constructError(ScriptRu ntime.java:3230)
>>> at
>>> org.mozilla.javascript.ScriptRuntime.typeError(ScriptRuntime .java:3246)
>>> at
>>> org.mozilla.javascript.ScriptRuntime.typeError2(ScriptRuntim e.java:3265)
>>> at
>>> org.mozilla.javascript.ScriptRuntime.undefCallError(ScriptRu ntime.java:3284)
>>> at
>>> org.mozilla.javascript.ScriptRuntime.getPropFunctionAndThis( ScriptRuntime.java:1965)
>>> at org.mozilla.javascript.gen.c183._c0(<inline>:3) at
>>> org.mozilla.javascript.gen.c183.call(<inline>) at
>>> org.mozilla.javascript.ContextFactory.doTopCall(ContextFacto ry.java:304)
>>> at
>>> org.mozilla.javascript.ScriptRuntime.doTopCall(ScriptRuntime .java:2769)
>>> at org.mozilla.javascript.gen.c183.call(<inline>) at
>>> org.mozilla.javascript.gen.c183.exec(<inline>) at
>>> org.eclipse.birt.core.script.ScriptContext.eval(ScriptContex t.java:224)
>>> at
>>> org.eclipse.birt.report.engine.executor.ExecutionContext.eva luate(ExecutionContext.java:549)
>>> ... 65 more
>>>
>>> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
>>>
>>> However, if you change the example to use this for the onCreate method:
>>>
>>> myrow=this.getRowData();
>>> CustName = myrow.getExpressionValue("row[CUSTOMERNAME]");
>>> if (CustName.indexOf("Mini") != -1)
>>> countOfMinis +=1;
>>>
>>> The example executes correctly. Also, I tried this for the script;
>>>
>>> CustName = this.getRowData().getExpressionValue("row[CUSTOMERNAME]");
>>> if (CustName.indexOf("Mini") != -1)
>>> countOfMinis +=1;
>>>
>>> and it works fine as well.
>>>
>>> So it appears like there might be some kind of parsing problem on the
>>> word "row" in the first example. It looks like the word "row" in the
>>> getExpressionValue method is being confused with the JavaScript
>>> variable, row.
>>>
>>> I'll enter a bugzilla bug for this. Also, I would be happy to help
>>> correct this tutorial example. Other than providing a correct
>>> example (until the bug is fixed, if it is a bug), is there another
>>> methodology for providing information to correct documentation
>>> examples? For instance, should I log a bugzilla for documentation
>>> issues as well?
>>>
>>> I believe I found an error in another document on the web site that I
>>> would like to report and provide a corrected example for as well.
>>>
>>> Regards,
>>>
>>> Susan
>>>
>>> Jane Tatchell wrote:
>>>
>>>
>>>> Thanks for your detailed comments. The online help, including the
>>>> tutorials, is based on release 2.1.0 of BIRT. There have been some
>>>> changes between 2.1.0 and 2.1.1, which may be causing some of the
>>>> problems that you're experiencing. I'll look at these issues and let
>>>> you know the outcome as soon as I can. I'm not personally familiar
>>>> with Tutorial 5, but I'll pass your comments onto my colleague who
>>>> wrote the tutorial. Unfortunately, he is taking some vacation right
>>>> now, but he'll be back in the office next Thursday.
>>>>
>>
>>
>>
Re: Tutorial 5, Field Guide to BIRT, problem running the "Writing an event handler in JavaScrip [message #203177 is a reply to message #201257] Mon, 27 November 2006 23:04 Go to previous message
Eclipse UserFriend
Originally posted by: home4slc.pacbell.net

I logged a bugzilla for the tutorial itself since the example has not
been corrected as of 2.2.0 M1.

https://bugs.eclipse.org/bugs/show_bug.cgi?id=165982

Regards,

Susan

Susan L. Cline wrote:
> Bug 162817 has been changed to a Report Designer bug. Should I log a
> bugzilla for the tutorial?
>
> Thanks,
>
> Susan
>
> Susan Cline wrote:
>
>> Hi Don,
>>
>> Thanks for your help with this. I logged a bug for the problem when
>> using the word "row" in the JavaScript titled "Report Engine error
>> parsing word "row" in evaluating JavaScript", bugzilla 162817.
>>
>> https://bugs.eclipse.org/bugs/show_bug.cgi?id=162817
>>
>> This was changed to a doc bug so the tutorial example could be
>> corrected. However, I made a comment to this bug that I thought that
>> BIRT should somehow throw a better error message when the word "row"
>> is encountered in a script and used as a variable.
>>
>> So I'm not sure if I should log a new bugzilla for the tutorial
>> correction or the existing bugzilla # should be used. No one has
>> commented on the bug yet, so I'm not sure what is going on with it.
>>
>> Thanks,
>>
>> Susan
>>
>> Don French wrote:
>>
>>> You are correct that there is a problem with the variable name,
>>> "row". It appears that "row" is now a prohibited variable name.
>>>
>>> There is another problem with the tutorial, however. It is no longer
>>> possible to access a variable within one handler if that varialbe was
>>> created in different event handler. Well, there is a way, but the
>>> tutorial tries to use the old method. The variable "countOfMinis"
>>> must be a serializable Java object and the methods that save and
>>> retrieve the serializable object are
>>> reportContext.setPersistentGlobalVariable( ) and
>>> reportContext.getPersistentGlobalVariable( ). The correct code for
>>> the three event handlers is:
>>>
>>>
>>>
>>> Table.onCreate:
>>>
>>> countOfMinis = new Packages.java.lang.Integer("1");
>>>
>>> reportContext.setPersistentGlobalVariable("cmKey", countOfMinis);
>>>
>>>
>>>
>>>
>>>
>>> Row.onCreate:
>>>
>>> countOfMinis = reportContext.getPersistentGlobalVariable("cmKey");
>>>
>>> row_Data = this.getRowData();
>>>
>>> CustName = row_Data.getExpressionValue( "row[CUSTOMERNAME]" );
>>>
>>> if(CustName.indexOf("Mini") != -1){
>>>
>>> mCount = countOfMinis.intValue();
>>>
>>> mCount += 1;
>>>
>>> countOfMinis = new Packages.java.lang.Integer(mCount);
>>>
>>> reportContext.setPersistentGlobalVariable("cmKey", countOfMinis);
>>>
>>> }
>>>
>>>
>>>
>>> ReportDesign.afterFactory:
>>>
>>> importPackage( Packages.javax.swing );
>>>
>>> countOfMinis =
>>> reportContext.getPersistentGlobalVariable("cmKey").intValue();
>>>
>>> frame = new JFrame( "Count of Minis = " + countOfMinis );
>>>
>>> frame.setBounds( 310, 220, 300, 20 );
>>>
>>> frame.show( );
>>>
>>> (Thanks to Jason Weathersby for helping me debug this.)
>>>
>>> "Susan Cline" <home4slc@pacbell.net> wrote in message
>>> news:ei5toa$l2m$1@utils.eclipse.org...
>>>
>>>> Hi,
>>>>
>>>> I played with this example some more and I'm thinking there might be
>>>> a bug with the way the word "row" is parsed.
>>>>
>>>> For Task 3 of Tutorial 5 here is the script that is supposed to be
>>>> typed into the onCreate method of the Script tab for the detailed
>>>> row CUSTOMERNAME.
>>>>
>>>> row=this.getRowData();
>>>> CustName = row.getExpressionValue("row[CUSTOMERNAME]");
>>>> if (CustName.indexOf("Mini") != -1)
>>>> countOfMinis +=1;
>>>>
>>>> As I mentioned in my previous email, running this script causes this
>>>> partial listing of the stack trace:
>>>> (This is the primary source: org.mozilla.javascript.EcmaError:
>>>> TypeError: Cannot call method "indexOf" of null (<inline>#3) at
>>>> org.mozilla.javascript.ScriptRuntime.constructError(ScriptRu ntime.java:3240)
>>>> )
>>>> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^
>>>>
>>>> .... lots of stuff cut out.....
>>>>
>>>> at
>>>> org.apache.coyote.http11.Http11Processor.process(Http11Proce ssor.java:828)
>>>> at
>>>> org.apache.coyote.http11.Http11Protocol$Http11ConnectionHand ler.processConnection(Http11Protocol.java:700)
>>>> at
>>>> org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndp oint.java:584)
>>>> at
>>>> org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.ru n(ThreadPool.java:683)
>>>> at java.lang.Thread.run(Thread.java:534)Caused by:
>>>> org.mozilla.javascript.EcmaError: TypeError: Cannot call method
>>>> "indexOf" of null (<inline>#3) at
>>>> org.mozilla.javascript.ScriptRuntime.constructError(ScriptRu ntime.java:3240)
>>>> at
>>>> org.mozilla.javascript.ScriptRuntime.constructError(ScriptRu ntime.java:3230)
>>>> at
>>>> org.mozilla.javascript.ScriptRuntime.typeError(ScriptRuntime .java:3246)
>>>> at
>>>> org.mozilla.javascript.ScriptRuntime.typeError2(ScriptRuntim e.java:3265)
>>>> at
>>>> org.mozilla.javascript.ScriptRuntime.undefCallError(ScriptRu ntime.java:3284)
>>>> at
>>>> org.mozilla.javascript.ScriptRuntime.getPropFunctionAndThis( ScriptRuntime.java:1965)
>>>> at org.mozilla.javascript.gen.c183._c0(<inline>:3) at
>>>> org.mozilla.javascript.gen.c183.call(<inline>) at
>>>> org.mozilla.javascript.ContextFactory.doTopCall(ContextFacto ry.java:304)
>>>> at
>>>> org.mozilla.javascript.ScriptRuntime.doTopCall(ScriptRuntime .java:2769)
>>>> at org.mozilla.javascript.gen.c183.call(<inline>) at
>>>> org.mozilla.javascript.gen.c183.exec(<inline>) at
>>>> org.eclipse.birt.core.script.ScriptContext.eval(ScriptContex t.java:224)
>>>> at
>>>> org.eclipse.birt.report.engine.executor.ExecutionContext.eva luate(ExecutionContext.java:549)
>>>> ... 65 more
>>>>
>>>> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
>>>>
>>>> However, if you change the example to use this for the onCreate method:
>>>>
>>>> myrow=this.getRowData();
>>>> CustName = myrow.getExpressionValue("row[CUSTOMERNAME]");
>>>> if (CustName.indexOf("Mini") != -1)
>>>> countOfMinis +=1;
>>>>
>>>> The example executes correctly. Also, I tried this for the script;
>>>>
>>>> CustName = this.getRowData().getExpressionValue("row[CUSTOMERNAME]");
>>>> if (CustName.indexOf("Mini") != -1)
>>>> countOfMinis +=1;
>>>>
>>>> and it works fine as well.
>>>>
>>>> So it appears like there might be some kind of parsing problem on
>>>> the word "row" in the first example. It looks like the word "row"
>>>> in the getExpressionValue method is being confused with the
>>>> JavaScript variable, row.
>>>>
>>>> I'll enter a bugzilla bug for this. Also, I would be happy to help
>>>> correct this tutorial example. Other than providing a correct
>>>> example (until the bug is fixed, if it is a bug), is there another
>>>> methodology for providing information to correct documentation
>>>> examples? For instance, should I log a bugzilla for documentation
>>>> issues as well?
>>>>
>>>> I believe I found an error in another document on the web site that
>>>> I would like to report and provide a corrected example for as well.
>>>>
>>>> Regards,
>>>>
>>>> Susan
>>>>
>>>> Jane Tatchell wrote:
>>>>
>>>>
>>>>> Thanks for your detailed comments. The online help, including the
>>>>> tutorials, is based on release 2.1.0 of BIRT. There have been some
>>>>> changes between 2.1.0 and 2.1.1, which may be causing some of the
>>>>> problems that you're experiencing. I'll look at these issues and
>>>>> let you know the outcome as soon as I can. I'm not personally
>>>>> familiar with Tutorial 5, but I'll pass your comments onto my
>>>>> colleague who wrote the tutorial. Unfortunately, he is taking some
>>>>> vacation right now, but he'll be back in the office next Thursday.
>>>>>
>>>
>>>
>>>
Previous Topic:java.lang.NoSuchMethodError: initStandardObjects
Next Topic:timestamp vs date???
Goto Forum:
  


Current Time: Thu Dec 12 19:42:52 GMT 2024

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

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

Back to the top