Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 324546

Summary: external .js file has no effect in beforeOpen if the data set is used to generate a dynamic parameter selection
Product: z_Archived Reporter: Yap Sok Ann <sokann>
Component: BIRTAssignee: Gang Liu <hustlg>
Status: RESOLVED FIXED QA Contact: Xiaoying Gu <bluesoldier>
Severity: normal    
Priority: P3 CC: bluesoldier, wenfeng.fwd
Version: unspecified   
Target Milestone: 2.6.2   
Hardware: PC   
OS: Linux   
Whiteboard: Obsolete
Attachments:
Description Flags
sample report
none
sample .js file none

Description Yap Sok Ann CLA 2010-09-06 02:47:57 EDT
Build Identifier: 

I define a function "replace_query" in an external .js file, and then include it in the report. I then use the function in the beforeOpen script. If the data set is not used to generate a dynamic parameter selection, then it works fine. Otherwise, when viewing the report, it will give this error:

Error evaluating Javascript expression. Script engine error: ReferenceError: "replace_query" is not defined.

Reproducible: Always

Steps to Reproduce:
1. Define a function in an external .js file
2. Include the .js file in the report
3. Call the function in the beforeOpen script of a data set that is also used to generate a dynamic parameter selection
Comment 1 Yap Sok Ann CLA 2010-09-06 02:49:41 EDT
Created attachment 178236 [details]
sample report
Comment 2 Yap Sok Ann CLA 2010-09-06 02:50:08 EDT
Created attachment 178237 [details]
sample .js file
Comment 3 Xiaoying Gu CLA 2010-09-06 05:27:18 EDT
(In reply to comment #2)
> Created an attachment (id=178237) [details]
> sample .js file

Which BIRT version were you using?

I can not reproduce this issue on BIRT 2.6.0 release, using the attached report and js file.
Dynamic parameter list pops up with customer names.
Comment 4 Yap Sok Ann CLA 2010-09-06 05:41:19 EDT
You are not supposed to see any customer name, because the beforeOpen script should have replaced "1 = 1" with "1 = 0"
Comment 5 Xiaoying Gu CLA 2010-09-06 06:02:08 EDT
(In reply to comment #4)
> You are not supposed to see any customer name, because the beforeOpen script
> should have replaced "1 = 1" with "1 = 0"

Which BIRT version were you using to reproduce this issue?
Comment 6 Yap Sok Ann CLA 2010-09-06 06:04:17 EDT
I am using version 2.5.2 here.
Comment 7 Wenfeng Li CLA 2011-01-19 17:48:35 EST
(In reply to comment #6)
> I am using version 2.5.2 here.

Can you try 2.6.1 to see if the issue still exists?  If yes, please reopen the bug.