Hi,<br />
<br />
i just have a little problem:<br />
<br />
I did that tutorial for creating a scripted datasource / dataset.<br />
Here is the link:<br />
<a class='bbc_url' href='
http://download.eclipse.org/birt/downloads/examples/scripting/scripteddatasource/scripteddatasource.html'>Created by Camtasia Studio 3</a><br />
Within of eclipse it works fine.<br />
<br />
But if I would like to deploy it into "RCP Report Designer" I get an exception<br />
that the class SimpleClass isn´t defined.<br />
<br />
Following exception I get:<br />
<pre class='_prettyXprint _lang-auto _linenums:0'>
A BIRT exception occurred.
Plug-in Provider:Eclipse.org
Plug-in Name:BIRT Data Engine
Plug-in ID:org.eclipse.birt.data
Version:2.5.0.v20090605
Error Code:data.engine.BirtException
Error Message:A BIRT exception occurred: There are errors evaluating script "__bm_open()":
ReferenceError: "SimpleClass" is not defined. (<inline>#3). See next exception for more information.
There are errors evaluating script "__bm_open()":
ReferenceError: "SimpleClass" is not defined. (<inline>#3)
</pre>
<br />
<strong class='bbc'>The aim is to put the classes into a jar-file, later I would like to use more classes for scripting in the future.<br />
A jar-file is tidier</strong><br />
<br />
I packed this classes into a jar-file and put it into that folder:<br />
BIRTbirt-rcp-report-designer-2_5_0pluginsorg.eclipse.birt.report.viewer_2.5.0.v20090520birtscriptlib<br />
<br />
After a restart of the "Birt Report Viewer" it doesn´t work.<br />
<br />
<br />
Here are the java-class and the scripts for you to copy in:<br />
<br />
java-class:<br />
<br />
<pre class='_prettyXprint _lang-auto _linenums:0'>
package test;
import java.util.Vector;
public class SimpleClass
{
public Vector readData(){
//This function simulates a read from an EJB/DB
Vector rtnV = new Vector();
rtnV.add(new String[]{"ANG Resellers", "1952 Alpine Renault 1300","Red"});
rtnV.add(new String[]{"AV Stores, Co.", "1969 Harley Davidson Ultimate Chopper","Blue"});
rtnV.add(new String[]{"Alpha Cognac", "1969 Ford Falcon","Blue"});
rtnV.add(new String[]{"American Souvenirs Inc", "1968 Ford Mustang","Green"});
rtnV.add(new String[]{"Amica Models & Co.", "1969 Corvair Monza","Blue"});
rtnV.add(new String[]{"Anna's Decorations, Ltd", "1969 Corvair Monza","Yellow"});
rtnV.add(new String[]{"Anton Designs, Ltd.", "1970 Plymouth Hemi Cuda","Orange"});
rtnV.add(new String[]{"Asian Shopping Network, Co", "1969 Dodge Charger","Plum Crazy Purple"});
rtnV.add(new String[]{"Asian Treasures, Inc.", "1969 Corvair Monza","Red"});
rtnV.add(new String[]{"Atelier graphique", "1972 Alfa Romeo GTA","Metalic Silver"});
return (rtnV);
}
public static void main(String[] args)
{
SimpleClass sc = new SimpleClass();
Vector rtn = sc.readData();
for( int i=0; i<rtn.size(); i++ ){
String[] sa = (String[])rtn.get(i);
System.out.println(sa[0] + "--" + sa[1] + "--" + sa[2] );
}
}
}
</pre>
<br />
open:<br />
<pre class='_prettyXprint _lang-auto _linenums:0'>
importPackage( Packages.test );
favoritesClass = new SimpleClass();
favorites = favoritesClass.readData();
totalrows = favorites.size();
currentrow = 0;
</pre>
<br />
fetch:<br />
<pre class='_prettyXprint _lang-auto _linenums:0'>
if( currentrow >= totalrows ){
return(false);
}
var favrow = favorites.get(currentrow);
var Customer = favrow[0];
var Favorite = favrow[1];
var Color = favrow[2];
row["Customer"]=Customer;
row["Favorite"]=Favorite;
row["Color"]=Color;
currentrow = currentrow + 1;
return (true);
</pre>
<br />
close:<br />
<br />
<pre class='_prettyXprint _lang-auto _linenums:0'>
favoritesClass = null;
favorites = null;
</pre>
<br />
<br />
Do you know where I have to put the jar-file for working of<br />
scripts within of "RCP Report Designer"?<br />
<br />
And what anything else I have to do for the correct working?<br />
<br />
Thank you very much.<br />
<br />
Bye<br />
NewInBirt