From: David B. <dbe...@be...> - 2006-03-30 19:45:52
|
I have successfully integrated Rhino Javascript with DataVision 1.0.0 using: BSF 2.3.0 (bsf.jar from bsf-bin-2.3.0.zip) Rhino 1.5R3 (js.jar from rhino15R3.zip) Note: Using exactly these versions is important! Here is an example of a static script that works: var status="C"; var status_label="Complete"; status_label; Note: a 'return' is not needed, the last expression evaluated becomes the return value so the Forumla above returns 'Completed' However, the following script does not work: var status="C"; var status_label=""; if ( status == "C" ) { status_label="Complete"; } else { status_label="Pending"; } status_label; When I run a report with this formula it returns: java.lang.StringIndexOutOfBoundsException: String index out of range: -1 DataVision console stack trace is: java.lang.StringIndexOutOfBoundsException: String index out of range: -1 at java.lang.String.substring(String.java:1768) at jimm.datavision.source.sql.Database.findColumn(Unknown Source) at jimm.datavision.Report.findColumn(Unknown Source) at jimm.datavision.Expression$4.replace(Unknown Source) at jimm.util.StringUtils.replaceDelimited(Unknown Source) at jimm.datavision.Expression.columnsUsed(Unknown Source) at jimm.datavision.field.FormulaField.columnsUsed(Unknown Source) at jimm.datavision.source.Query$1.step(Unknown Source) at jimm.datavision.Report$10.step(Unknown Source) at jimm.datavision.SectionArea.withSectionsDo(Unknown Source) at jimm.datavision.Report.withSectionsDo(Unknown Source) at jimm.datavision.Report.withFieldsDo(Unknown Source) at jimm.datavision.source.Query.findSelectablesUsed(Unknown Source) at jimm.datavision.source.sql.SQLQuery.findSelectablesUsed(Unknown Source) at jimm.datavision.source.sql.SQLQuery.queryAsString(Unknown Source) at jimm.datavision.source.sql.SQLQuery.toPreparedStatementString(Unknown Source) at jimm.datavision.source.sql.ResultSetRow.<init>(Unknown Source) at jimm.datavision.source.sql.Database.execute(Unknown Source) at jimm.datavision.Report.runReport(Unknown Source) at jimm.datavision.Report$9.run(Unknown Source) at java.lang.Thread.run(Thread.java:595) Does anyone have any ideas? |