Jump to content
Changes to the Jaspersoft community edition download ×

REPORT_DATA_SOURCE Problem


2005 IR Help

Recommended Posts

By: treya3 - treya3

REPORT_DATA_SOURCE Problem

2004-12-07 13:19

I have written a servlet to generate a PDF from a report following the WebApp sample. I am using a custom data source that I created. When I make the call JasperRunManager.runReportToPdf(String, Map, JRDataSource), I get the following error:

 

net.sf.jasperreports.engine.JRException: Incompatible value assigned to parameter REPORT_DATA_SOURCE : <report name>

 

 

Is there something special that I have to do to the report for it to recognize the data source? (I have setup the fields in the report.) Could there be something missing from my data source that would cause this problem?

 

Thanks in advance,

Trey

 

 

 

 

By: treya3 - treya3

RE: REPORT_DATA_SOURCE Problem

2004-12-10 09:57

Here is my custom data source. Any ideas as to why this is considered incompatible?

 

 

 

package org.sw.reports.dataSources;

 

import java.util.List;

 

import org.sw.formEngine.SWForm;

 

import net.sf.jasperreports.engine.JRDataSource;

import net.sf.jasperreports.engine.JRException;

import net.sf.jasperreports.engine.JRField;

 

public class SWFormListDataSource implements JRDataSource {

 

private int index = -1;

private List swforms = null;

 

/**

*

* @param forms List of SWForm objects

*/

public SWFormListDataSource(List forms) {

System.out.println("SWFormListDataSource: Setting up this.swforms.");

this.swforms = forms;

System.out.println("SWFormListDataSource: swform enr id - " + ((SWForm)this.swforms.get(0)).getContentString("pt_enrid"));

System.out.println("SWFormListDataSource: swform first name - " + ((SWForm)this.swforms.get(0)).getContentString("pt_fname"));

}

 

/**

* @see net.sf.jasperreports.engine.JRDataSource#next()

*/

public boolean next() throws JRException {

index++;

System.out.println("SWFormListDataSource: index is now: " + index);

 

return (index < this.swforms.size());

}

 

/**

* @see net.sf.jasperreports.engine.JRDataSource#getFieldValue(net.sf.jasperreports.engine.JRField)

*/

public Object getFieldValue(JRField field) throws JRException {

SWForm swform = (SWForm) this.swforms.get(index);

 

System.out.println("SWFormListDataSource: field name is: " + field.getName());

System.out.println("SWFormListDataSource: content string is: " + swform.getContentString(field.getName()));

 

return swform.getContentString(field.getName());

}

 

}

 

 

 

 

 

By: treya3 - treya3

Custom Data Source

2004-12-14 08:38

For some reason, the error message I receive when trying to use my custom data source has changed. It now tells me that the data source class I posted above "does not implement interface net.sf.jasperreports.engine.JRDataSource", but I coded everything to implement that interface! Can anyone tell me why Jasper is not accepting my data source?!?!?

Link to comment
Share on other sites

  • Replies 0
  • Created
  • Last Reply

Top Posters In This Topic

Popular Days

Top Posters In This Topic

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...