Jump to content
Changes to the Jaspersoft community edition download ×

Table not displaying any values


AnjumAbbas

Recommended Posts

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

 

Link to comment
Share on other sites

  • Replies 5
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

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

Link to comment
Share on other sites

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!

 

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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! :)

 

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...