| Author |
Message |
|
|
Post subject: Missing the First line of a subreport
Posted: Jul 25, 2006 - 03:53 PM
|
|
|
|
Hello,
I'm having a problem with JasperReports 1.2.5. I'm trying to generate a report with a subreport in it, using J2EE + Struts. I take a connection from database and generate a Collection, and then I send it to the JasperReport using JRBeanCollectionDataSource class. Everything works fine, but the subreport does not show the first line of the Collection, it just jumps to the second line of Collection, and generates the rest of the pdf file. Does anyone ever passed by a situation like this? How can I solve this problem?
Thanks for any help. |
|
|
| |
|
|
|
 |
|
|
Post subject: RE: Missing the First line of a subreport
Posted: Jul 26, 2006 - 02:31 PM
|
|
|
|
|
|
|
 |
|
|
Post subject: RE: Missing the First line of a subreport
Posted: Jul 26, 2006 - 03:02 PM
|
|
|
|
I already generate the report, but the problem is the first element missing in the begining of subreport. The report is correctly generated in the application, but it misses the first element of collection. As I said, I'm using JRBeanCollectionDataSource class to bring data to subreport. How can I solve this problem?
Thanks for any help. |
|
|
| |
|
|
|
 |
|
|
Post subject: RE: Missing the First line of a subreport
Posted: Jul 26, 2006 - 04:24 PM
|
|
|
|
Hello,
I have found a solution: Add a empty bean to the collection. After that, the JRBeanCollectionDataSource have read correctly the list of beans from collection. I think that JRBeanCollectionDataSource begins countting the Collection object from 1 and not from 0.
Thanks for your attention |
|
|
| |
|
|
|
 |
|
|
Post subject: Re: RE: Missing the First line of a subreport
Posted: Jan 28, 2008 - 04:07 PM
|
|
Joined: Jan 28, 2008
Posts: 1
|
|
Hi,
I am trying to create PDF using iReport and JasperReports. I have 2 classes, 'Student' and 'Course'. Student class and can contain multiple Course(es).
package com.subreports;
public class Student {
String id;
String firstName;
String lastName;
String age;
List coursesTaken;
public Student() {}
public Student(String id, String firstName, String lastName, String age) {
this.id = id;
this.firstName = firstName;
this.lastName = lastName;
this.age = age;
}
public static List createBeanCollection(){
List list = new ArrayList ();
Student student = new Student("01","ABC", "XYZ", "20");
List al = new ArrayList();
al.add(new Course("01","0001", "Investment Banking"));
al.add(new Course("01","0002", "Marketing"));
student.setCoursesTaken(al);
list.add(student);
return list;
}
//all getters and setters defined here....
}
package com.subreports;
public class Course {
String studentID;
String courseID;
String courseName;
public Course() {}
public Course(String studentID, String courseID, String courseName) {
super();
this.studentID = studentID;
this.courseID = courseID;
this.courseName = courseName;
}
//all getters and setters are defined here
}
I complied these classes and put the jar file containing these 2 classes into 'lib' folder of iReport.
I created Master and inserted subReport. In master report I passed the following parameter to subReport
SubReport Parameter Name: coursesTaken
Default value Expression: new net.sf.jasperreports.engine.data.JRBeanCollectionDataSource($F{coursesTaken})
In subReport I defined ONE Parameter named 'coursesTaken' of type 'java.util.Collection'. I also defined 3 Fields namely 'studentID', 'courseID' and 'courseName' and also dropped these fields in 'Detail' section of report.
Complied both classes. When I try to run Master report. I receive below error:
Error filling print... net.sf.jasperreports.engine.JRException: Incompatible net.sf.jasperreports.engine.data.JRBeanCollectionDataSource value assigned to parameter coursesTaken in the Student-Test_subreport0 dataset.
Please help me if you know why I am receiving this error and How to rectify this.
I am trying to display all the courses corresponding to each student as sub report. I am receiving data in the form mentioned like Student and Course. I can not change that.
Thanks in advance.
| Anonymous wrote: | Hello,
I have found a solution: Add a empty bean to the collection. After that, the JRBeanCollectionDataSource have read correctly the list of beans from collection. I think that JRBeanCollectionDataSource begins countting the Collection object from 1 and not from 0.
Thanks for your attention |
|
|
|
| |
|
|
|
 |
|
|
Post subject: subreport with JRBeanCollectionDataSource
Posted: Jul 16, 2008 - 04:58 PM
|
|
Joined: Jul 16, 2008
Posts: 1
|
|
Hi all
I am facing a problem in my subreport
I have a main report which i populate by JRBeanCollectionDataSource by bean A
and the subreport report i populate by JRBeanCollectionDataSource by bean B
but I am not able to see the subreport , how can we do this
please help .
--
Kind Regards
Nasir Qureshi |
|
|
| |
|
|
|
 |
|
|
Post subject:
Posted: Jul 22, 2008 - 11:05 AM
|
|
Joined: Jul 22, 2008
Posts: 1
|
|
Hello !
I'm having a similar problem...
I have some subreports with columns, the first element of each report is empty. The subreport starts printing the elements in the second column for the first line. In the other lines it works fine.
does anybody knows why ?
Thanks in advance ! |
|
|
| |
|
|
|
 |
|
|