Dynamic columns in BIRT Report

Options
viky4frnds
edited February 11, 2022 in Analytics #1
<div>Hi,</div>
<div> </div>
<div>I have a requirement in BIRT Report.</div>
<div> </div>
<div>I need to create a table in BIRT in the below format.</div>
<div> </div>
<div>S.No Name    subj1 subj2 subj3</div>
<div>==========================</div>
<div>1       abc      10    20     30</div>
<div>
</div>
<div>2       def      20    30     40</div>
<div> </div>
<div> </div>
<div> </div>
<div>In this example S.No and Name are static. But rest of the fields are dynamic.(ie., subj1, subj2, etc are values in SUBJECT table in a database)</div>
<div>How can i make those headers are dynamic? Also how can i handle the report queries based </div>
<div>on dynamic header columns?</div>
<div> </div>
<div>Could somebody please help me how to handle this in BIRt report</div>

Comments

  • <p>Use a crosstab.</p>
  • <p>Mica is right, using a crosstab would be the best solution.</p>
    <p> </p>
    <p>However for reference, see the following post for an example that dynamically creates a Data Set based on the number of columns returned from a database query, then dynamically creates a table based on the Data Set information.</p>
    <p><a data-ipb='nomediaparse' href='http://developer.actuate.com/community/forum/index.php?/topic/24254-creating-column-dynamically/?p=132987'>http://developer.actuate.com/community/forum/index.php?/topic/24254-creating-column-dynamically/?p=132987</a></p&gt;
    Warning No formatter is installed for the format ipb
  • <p>Thanks for your response. Using Cross tab, I am able to get dynamic headders (ie., <span style="color:rgb(40,40,40);font-family:'Source Sans Pro', sans-serif;">subj1 subj2 subj3). However, other headers (</span><span style="color:rgb(40,40,40);font-family:'Source Sans Pro', sans-serif;">S.No Name) are static. I am not able to get these static headers in cross tab. <br>
    Could you please help me how to achieve this.</span></p>
  • <p>Please provide sample data (CSV) and version of BIRT you are using.</p>
  • <p>Thanks for the response.I have attached the required data in sample CSV file. In the CSV file, Student_Id and Student_Name are static header columns. Rest all the other columns Maths, Physics and Computer are needs to be read from database table 'SUBJECTS' and display the dynamic headers along with other body of the data. If user adds the new subject Chemistry in 'SUBJECTS' table in future, We needs to display the Chemistry column also in report header dynamically. How can i achieve this?<br>
    I am using BIRT Designer Version 4.4.0.</p>
    <p> </p>
    <p>Thanks.</p>
  • micajblock
    edited July 21, 2016 #7
    Options
    <p>Is this what you were looking for? I had to change the data slightly so the subjects were rows, not columns.</p>
  • <p>Thanks so much for the response Mica J. Block. This is the exact format i looked for. Your samples helped me lot. </p>
    <p>This is one more requirement. I needed to hide particular column based on the input parameter. For Example In header we are displayed Computer, Maths and Physics. If i passed P_Maths =0 then I need to hide the particular Maths column alone. How can I achieve this hiding particular column in Crosstab. <span style="color:rgb(40,40,40);font-family:'Source Sans Pro', sans-serif;">Could you please help me how to achieve this? If you share any samples that will help for me.</span></p>
    <p> </p>
    <p><span style="color:rgb(40,40,40);font-family:'Source Sans Pro', sans-serif;">Thanks in Advance</span></p>
  • <p>Is the data set using a database. The easiest is to add a where clause to your query based on the parameter.</p>
  • <p>Yes this dataset is using database only. But if it is hide/display based on input parameter, it will be helpful. Is that possible in crosstab?</p>
    <p> </p>
    <p> </p>
    <p>Thanks in advance</p>
  • <p>The data cube is based on the data set. So if the data set is filtered so will the data cube, so it will essential hide the columns.</p>
  • <p>Thank you so much:)</p>