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

Bug 190500

Summary: Javascript DataSet can't Preview Results, but Preview Page works
Product: z_Archived Reporter: Don Vale <don.vale>
Component: BIRTAssignee: Gary Xue <xxue>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: Antti.Karanta, bluesoldier, kim.baddeley, lzhu, wenfeng.fwd, xxue
Version: 2.1.2Keywords: plan
Target Milestone: Future   
Hardware: PC   
OS: Windows XP   
Whiteboard: Obsolete

Description Don Vale CLA 2007-06-01 12:15:39 EDT
Build ID: 2.1.2

Steps To Reproduce:
1.In Report Designer, create a javascript data source and data set.
2. The dataset open script event imports a package (such as importPackage(Packages.com.company) and uses a string defined in myclass in that package such as:
var foo = myclass.name_key;
3. The jar containing the com.company.myclass class is in the ...\eclipse\plugins\org.eclipse.birt.report.viewer_2.1.2.v20070205-1728\birt\scriptlib directory.

4. The report previews correctly if I use the Page->Preview menu item. However, if in the outline view I edit the dataset and click on the "Preview Results" list item, I get the following exception:

birt.core.JavascriptError
A BIRT exception occurred: Error evaluating Javascript expression. Script engine error:
ReferenceError: "myclass" is not defined. (DataSet[Jobs Data Set].__bm_open#20)

Line 19 is where I referenced myclass.name_key. From the debugger, I know that the script expression is wrapped in a function definition ___bm_open, so I see that is why the line numbering is off by 1.

More information:
So it seems that the class loading scope is different for the dataset preview page than it is when previewing the report.
Comment 1 Lin Zhu CLA 2007-06-02 05:55:01 EDT
Script lib is not available in design time so in design time preview we cannot access it.This is the source of problem.

Defer the bug to 2.2.1.
Comment 2 Mingxia Wu CLA 2007-08-03 02:30:56 EDT
In dataSetEditor preview, it's not easy for us to access the ClassLoader in birt viewer.Need to discuss whether we should support it in design time.
Comment 3 Wenfeng Li CLA 2007-08-21 23:22:23 EDT
Need to discuss how to support class loading in data preview.
Comment 4 Lin Zhu CLA 2007-09-04 04:32:02 EDT
*** Bug 202092 has been marked as a duplicate of this bug. ***
Comment 5 Kim Baddeley CLA 2007-09-04 14:28:30 EDT
With reference to the test case in duplicate Bug 202092 I have also discovered that if the scripted data set is used as a dynamic list of parameters, when the report is run in the designer the parameter list is not populated. I am not sure if this is another symptom of the same bug or I should raise a new one?
Comment 6 Antti Karanta CLA 2007-09-05 02:33:56 EDT
*** Bug 202049 has been marked as a duplicate of this bug. ***
Comment 7 Gary Xue CLA 2008-05-29 18:58:16 EDT
Suggest deferral to next major release. It's difficult for Data set preview to consume the Viewer's class path (the latter being logically a downstream component). I think we should consider a uniform approach where BIRT designer introduces a class path preference setting, and all editors and the viewer will use that class path. 
Comment 8 Lin Zhu CLA 2008-05-29 22:23:33 EDT
This bug actually duplicated with 203642, 206054 and 219577. The fix has been introduced in 2.3.0RC2.

Mark as resolved.