Urgent:run scriptlet to return - document is empty

0

HI,  I am using scriptlet in jasper studio, I do following steps:

1. copy demo scriptlet java code to netbean project to build  a jar file.

2. add jar file to jasper studio  java build path (add external jar to studio project java build path)

3. create a new simple report with static text and text fileds.

3. add script class for report properties,

4. define $P{report_scriptlet}  properities with script class.

then I copy demo code-  set text filed expression -->    $P{report_scriptlet}.hello()

then I run it in studio , it return me "document is empty!"  what that mean?

I am sure now studio can found my scriptlet, since compile is fine , and console return message :

Start Report Execution
Compiling report......DONE
Setting Data Adapter...DONE
Setting Virtualizer...DONE
Filling Report........DONE
Report Execution Finished.

 

any help is appreciated!

 

 

 

 

wangmin2001's picture
Joined: Aug 21 2014 - 11:34pm
Last seen: 4 years 8 months ago

2 Answers:

1

"Document is Empty" means that your main data set query did not return any records. If you're not using the main data set query (perhaps you're retrieving your data from sub-data sets or the scriptlet itself) then you need to put in a static query to return at least one result. Here are some examples:

Oracle: select 1 from DUAL

PostgreSQL: select 1 as field1

MySQL: select 1

eferrell's picture
609
Joined: Jun 11 2014 - 9:03am
Last seen: 4 years 2 months ago
0

eferrell, thank you very much.

I add a simple query for main report ,and it works!

I think it's a not good feature since sometimes we do not need a query.

aanyway ,thank you very much.

 

 

 

 

wangmin2001's picture
Joined: Aug 21 2014 - 11:34pm
Last seen: 4 years 8 months ago
Feedback