How to create indentation within BIRT Reports



How to create indentation within BIRT Reports


Indentation can be used within Birt Reports to represent hierarchy structure of various objects. The example below applies indentation to a Projects Requirements:

  • Open Silk Central Test Manager and go to ADMINSTRATION | REPORTS and download the "All Requirements" Report
  • Open Birt Reports and open the All Requirement.rptdesign Report
  • From within the OUTLINE pane expand the "Body" and select "Table" element. Change the layout view to script.

  • Ensure that the script is "onPrepare" mode and create a new variable blankSpace

Because this example is used to illustrate indentation only the requirement name is required. We will now remove all of the other requirement attributes.

  • From the Outline pane, expand "Table" and "Detail". Select all of the rows except for the first row, right click on the mouse and select delete.

  • Expand "Row" → "Cell" → "Data(reqName)" and click on the "Script" view and ensure the "onCreate" script is selected
  • Add the following lines of code to the end of existing code:

//loop through the reqNum for any instances of character . to determine indenting

if (reqNumber!=currentNumber){

for (var x=1; x

if(reqNumber.charAt(x)==".") blankSpace=blankSpace " ";



  • Go to the Outline Pane and select "Text" below "Data(reqName)"
  • Select the "Layout" view and double click on the highlighted cell (
  • Modify the value of it so it includes the blankSpace at the start of the String:

    blankSpacereqNumber " " row["reqName"]

    • Save the report and upload to SilkCentral Test Manger by either creating a new report or updating a current one

Old KB# 25119
Comment List