BIRT報表script,birtscript

來源:互聯網
上載者:User

BIRT報表script,birtscript

1.隔行高亮顯示

1. 在布局(Layout)中,選擇Table-Detail的行。如:

 

2. 然後選擇Script,開啟指令碼視窗頂部的方法列表並選擇onPrepare,。

var count=0;

 


3. 最後開啟指令碼視窗頂部的方法列表並選擇 onCreate,:

count++;
if (count % 2 != 0) {
  style.setBackgroundColor(silver);
 }

 

 

4. 儲存,點擊Preview預覽結果如。


這是網上找別人的案例來的,然後就照著做,就出現問題了

報了一大堆問題:

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表示說我的count未定義,我不是明明定義了嗎。

又到網上搜了,然後就說:

不是在明細行的script裡定義count,定義count也不能使用var哦。
要在表格的onprepare裡定義count=0;

貌似在明細裡還是在表格的script定義都一樣,然後把它修整過來,竟然可以了。

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

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.