| Summary: | before_open causing strange errors | ||||||||
|---|---|---|---|---|---|---|---|---|---|
| Product: | z_Archived | Reporter: | Low Kian Seong <kianseong> | ||||||
| Component: | BIRT | Assignee: | Birt-ReportDesigner <Birt-ReportDesigner-inbox> | ||||||
| Status: | RESOLVED WORKSFORME | QA Contact: | Sissi Zhu <szhu> | ||||||
| Severity: | normal | ||||||||
| Priority: | P3 | CC: | bluesoldier, hao.zhou, lchan | ||||||
| Version: | 2.2.0 | ||||||||
| Target Milestone: | 4.4.0 | ||||||||
| Hardware: | PC | ||||||||
| OS: | Linux | ||||||||
| Whiteboard: | |||||||||
| Attachments: |
|
||||||||
|
Description
Low Kian Seong
Created attachment 193648 [details]
before_open_script
before_open script used with the dataset
Created attachment 193649 [details]
Query used in DataSet
Query used with DataSet when error occurs.
The error that I get is this:
A BIRT exception occurred.
Plug-in Provider:Eclipse.org
Plug-in Name:BIRT Data Engine
Plug-in ID:org.eclipse.birt.data
Version:2.6.2.r262_v20110215
Error Code:data.engine.FailToExecuteScript
Error Message:Fail to execute script in function __bm_beforeOpen(). Source:
------
" + var multipattern=/![a-zA-Z_]*/gi;
var multivars = this.queryText.match(multipattern);
if(multivars){
for(i=0;i<multivars.length;i++)
{
var curvar = multivars[i].substr(1);
var cleaned = params[curvar].toString().replace(/\'/g,"\\'");
var toreplace = "'" + cleaned.replace(/,/g,"','") + "'";
var target=multivars[i];
if(toreplace=='All'){
target=" in ("+multivars[i]+")";
toreplace=" not in ('"+multivars[i]+"')";
}
this.queryText = this.queryText.replace(target,toreplace);
}
logToDebugWindow(toreplace);
}
var multipattern=/#[a-zA-Z_]*/gi;
var multivars = this.queryText.match(multipattern);
if(multivars){
for(i=0;i<multivars.length;i++)
{
var curvar = multivars[i].substr(1);
var toreplace = params[curvar].toString();
var target=multivars[i];
if(toreplace=='-1'){
target=" in ("+multivars[i]+")";
toreplace=" not in (-1)";
}
this.queryText = this.queryText.replace(target,toreplace);
}
} + "
-----
A BIRT exception occurred. See next exception for more information.
Error evaluating Javascript expression. Script engine error: TypeError: Cannot call method "toString" of undefined (/report/data-sets/oda-data-set[@id="522"]/method[@name="beforeOpen"]#8)
Script source: <inline>, line: 0, text:
__bm_beforeOpen()
Can you reproduce this error if have below contents in your scirpts:
var toreplace = params[curvar].toString();
var cleaned = params[curvar].toString().replace(/\'/g,"\\'");
And what's the defination of params[curvar], type and value when run the report?
See comment #4. If the issue still exists for you, please feel free to reopen the bug with more details on how to reproduce. |