title: Printing the data in horizontal order. Dynamic columns
body: <p>I am facing some issues with the design of the below <em>JasperReports</em> format:</p>
  
  <p>I have a requirement where in I need to print the data in horizontal order rather than vertical.</p>
  
  <p>There are two tables:</p>
  
  <p>Teacher</p>
  
  <pre><code>Teacher_Id  Teacher_Name
  1            Tom
  2            Monique
  3            Sofie
  </code></pre>
  
  <p>Subject</p>
  
  <pre><code>Subject_Id  Subject_Name
    1            Phy
    2            Chem
    3            Bio
    4            Eng
  Etc.... 
  </code></pre>
  
  <p>The report presentation is something like this below where the Subject column would grow horizontally for each record.</p>
  
  <pre><code>TeacherId         TeacherName                    Subjects
  
  1                 Tom                Physics        Chem          Bio
  2                 Sofie              Eng            History       Geography
  3                 Monique            Eng            Chem          Physics
  </code></pre>
  
  <p>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:</p>
  
  <pre><code>TeacherId         TeacherName                         Subjects
                                     Physics        Chem          Bio      Eng
  
  1                 Tom                Yes         
  2                 Sofie                            Yes               
  3                 Monique                                       Yes            
  </code></pre>
  
  <p>Any clue how to go about this?</p>