BIRT report script, birtscript

Source: Internet
Author: User

BIRT report script, birtscript

1. line separation highlighted

1. in Layout, select the rows of Table-Detail. For example:

 

2. Select Script, open the method list at the top of the Script window, and select onPrepare ,.

Var count = 0;

 


3. Open the method list at the top of the script window and select onCreate ,:

Count ++;
If (count % 2! = 0 ){
Style. setBackgroundColor (silver );
}

 

 

4. Save and Click Preview to Preview the result, as shown in.


This is the case of finding someone else online. Then, the problem occurs.

A lot of problems were reported:

Multiple annotations found at this line:- org.eclipse.birt.report.engine.api.EngineException: There are errors evaluating script "count++; if (count % 2 != 0)  {   style.setBackgroundColor("#000000"); }": ReferenceError: "count" is not defined. (/report/body/grid[@id="43"]/row[@id="45"]/cell[@id="46"]/ table[@id="49"]/detail/row[@id="54"]/method[@name="onCreate"]#1) at  org.eclipse.birt.report.engine.script.internal.ScriptExecutor.addException(ScriptExecutor.java:249) at  org.eclipse.birt.report.engine.script.internal.RowScriptExecutor.handleOnCreate(RowScriptExecutor.java:64) at  org.eclipse.birt.report.engine.script.internal.OnCreateScriptVisitor.visitRow(OnCreateScriptVisitor.java:167) at  org.eclipse.birt.report.engine.ir.RowDesign.accept(RowDesign.java:108) at  org.eclipse.birt.report.engine.script.internal.OnCreateScriptVisitor.onCreate(OnCreateScriptVisitor.java:73) at  org.eclipse.birt.report.engine.executor.ReportItemExecutor.handleOnCreate(ReportItemExecutor.java:917) at  org.eclipse.birt.report.engine.executor.RowExecutor.execute(RowExecutor.java:83) at  org.eclipse.birt.report.engine.internal.executor.wrap.WrappedReportItemExecutor.execute(WrappedReportItemExecutor.java:46) at  org.eclipse.birt.report.engine.internal.executor.emitter.ReportItemEmitterExecutor.execute(ReportItemEmitterExecutor.java:46) at  org.eclipse.birt.report.engine.internal.executor.dup.SuppressDuplicateItemExecutor.execute(SuppressDuplicateItemExecutor.java:43) at  org.eclipse.birt.report.engine.internal.executor.wrap.WrappedReportItemExecutor.execute(WrappedReportItemExecutor.java:46) at  org.eclipse.birt.report.engine.internal.executor.l18n.LocalizedReportItemExecutor.execute(LocalizedReportItemExecutor.java:34) at  org.eclipse.birt.report.engine.layout.html.HTMLBlockStackingLM.layoutNodes(HTMLBlockStackingLM.java:65) at  org.eclipse.birt.report.engine.layout.html.HTMLStackingLM.layoutChildren(HTMLStackingLM.java:26) at ...
ReferenceError: "count" is not defined indicates that my count is not defined. Isn't it clearly defined.

I searched the internet and then said:

Instead of defining count in the script of the line details, defining count cannot use var.
Define count = 0 in onprepare of the table;

It seems that the definition of the script in the table is the same in the details, and then it can be trimmed.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.