raikumardipak
raikumardipak

Reputation: 1585

Printing the data in horizontal order. Dynamic columns

I am facing some issues with the design of the below JasperReports format:

I have a requirement where in I need to print the data in horizontal order rather than vertical.

There are two tables:

Teacher

Teacher_Id  Teacher_Name
1            Tom
2            Monique
3            Sofie

Subject

Subject_Id  Subject_Name
  1            Phy
  2            Chem
  3            Bio
  4            Eng
Etc.... 

The report presentation is something like this below where the Subject column would grow horizontally for each record.

TeacherId         TeacherName                    Subjects

1                 Tom                Physics        Chem          Bio
2                 Sofie              Eng            History       Geography
3                 Monique            Eng            Chem          Physics

I have used a subreport for subjects. And have been able to grow the list of subjects horizontally by specifying column “20” and printOrder “horizontal”. But with this approach the columns get printed horizontally but don’t grow horizontally. There size is fixed to 20 and as such leave a lot of blank space. I am not sure how to make the subjects column grow dynamically in horizontal direction (dynamic columns). I also tried the option of subreport + list element but without success. Crosstabs is something I haven’t tried and am neither sure if it would work out. If I can achieve dynamic columns, then I can aim for the next level of the report output which it would look something like below:

TeacherId         TeacherName                         Subjects
                                   Physics        Chem          Bio      Eng

1                 Tom                Yes         
2                 Sofie                            Yes               
3                 Monique                                       Yes            

Any clue how to go about this?

Upvotes: 1

Views: 1917

Answers (1)

raikumardipak
raikumardipak

Reputation: 1585

We have to use crosstab in ireports to get dynamic columns

Upvotes: 1

Related Questions