Note to BIRT script developers [message #41117] |
Wed, 25 May 2005 02:13 |
Eclipse User |
|
|
|
This is a note to BIRT report developers who are using the scripting
feature with Milestone 3 or earlier builds. Please note that from the
2005-05-23 nightly build and onward, there has been an incompatible change
in the way that data set and data source scripts are evaluated. As a
result you may need to update your BIRT report scripts. This change mostly
affects the development of Scripted Data Sets.
Each script is now evaluated as if it's the body of a function. It was
previously evaluated as an expression. For scripts that must return a
value (such as the "fetch" script of a Scripted Data Set), the "return"
keyword must be used to return a value. So, instead of
{ if (cond) value1; else value2; }
The script must do
{ if (cond) return value1; else return value2; }
Since each script is evaluated within its own function scope, a local
variable declared in one script using the "var" keyword cannot be accessed
in another function. Use global variables (without the var declaration) to
store values that need to be passed between functions.
Therefore, the following scripts in a Scripted Data Set that used to work
will no longer:
open: { var count = 0 ; }
fetch: { row.x = count; ... }
To fix this, use:
open: { count = 0; }
fetch: { row.x = count; ... }
Happy scripting,
Gary Xue
BIRT Committer
|
|
|
Powered by
FUDForum. Page generated in 0.04228 seconds