Table not displaying any values

0

Hi,

This is the first time I've used tables in my report. The main report works fine with a database connection and it displays all the data.

I have two tables.

Table 1 is at the top of the report and simply displays some parameters from the main report. But the values are displaying as null for these. I've set the Dataset for this as Connection / Datasource exp and it is set to new net.sf.jasperreports.engine.JREmptyDataSource(). I've added the parameters that I need in this table from the main report parameters to the Table Dataset 1 parameters. I've also added the parameters under the parameters tab in the edit table datasource!

Table 2 is placed in the Summary band of the main report. This uses a query to retrieve fields, using the same datasource connection as the main report. The query string uses parameters from the main report. Again I've added the parameters I need for the query to Table Dataset 2 and to the parameters tab!

I've followed all the instructions and the whole report compiles just fine but when I run it Table 1 shows null where the parameter values are meant to be shown. And Table 2 shows nothing at all where the field values are meant to be shown!!

Could someone please help!

I've attached the jrxml file.

thanks,

Anjum

 

AnjumAbbas's picture
Joined: Jul 17 2013 - 1:14am
Last seen: 5 years 5 months ago

5 Answers:

1

Hi,

In table 1, you add parameter same as main report parameter then i think you not mapped parameter.

Right click on table component and mapped parameter of main report with table datasource parameter then your table datasource get value of main report parameter.

Do same with table 2 if table 2 datasource uses parameter from main report.

Regards,

Ajinkya

ajinkya_c's picture
976
Joined: Aug 29 2012 - 6:13am
Last seen: 2 years 6 months ago
0

Hi Ajinkya,

Ok so I think I did what you said. I clicked on edit table datasource on table 1 and 2 and on the parameters tab I hit modify for each parameter and added a value expression which I picked from the pick list to be the one for the main report.

So both tables are now working and pulling through values but the main report has stopped working!! And is showing NULL for all values!!

Help!

 

AnjumAbbas's picture
Joined: Jul 17 2013 - 1:14am
Last seen: 5 years 5 months ago
0

Hi,

The main report datasource & table datasource are different so the query of main datasource & table datasource execute separate. 

Please check your query manually may be your query execute with no records, Execute your query manually by passing same parameter which you passed in jasper report.

Becouse some parameter may having data for table datasource & not for main datasource, this could be possibility. 

Regards,

Ajinkya

ajinkya_c's picture
976
Joined: Aug 29 2012 - 6:13am
Last seen: 2 years 6 months ago
0

I've checked the query in the main report using the parameters and it executes fine.

But that's what I was expecting as the main report was working fine before I mapped the table parameters to those of the main report parameters.

AnjumAbbas's picture
Joined: Jul 17 2013 - 1:14am
Last seen: 5 years 5 months ago
0

Sorted this.

The problem was that in trying to fix the tables I'd been trying different datasources pass in when filling my report.

The one I needed was the database connection below and not the one that I've now commented out!

            JasperPrint jasperPrint = JasperFillManager.fillReport(
                    jasperReport, parameters, conn);


//            jasperPrint = JasperFillManager.fillReport(jasperReport, parameters, new JREmptyDataSource());

Thanks for you help Ajinkya, both tables and the main report now work a treat! :)

 

AnjumAbbas's picture
Joined: Jul 17 2013 - 1:14am
Last seen: 5 years 5 months ago
Feedback
randomness