Scripts: Multicolumn Report with Horizontal Order

To save report space and make report more visual, one can create multicolumn report, using the ColumnsCount property of the DataBand. The data will be output by columns and the report will look like the following:

If it is necessary one can create template to output data by rows in the following way:

The example template: MulticolumnReportwithHorizontalOrder.rst.

In order to create this template, make the following steps.

Step 1. Set Document.ScriptLanguage to Csharp. Write the following script as Document.CommonScript:

bool flag = true;
int columnsCount = ;

Step 2. Add DataBand to the template. Set DataSource property.
Add Detail to the DataBand, set binding Detail.Visible to “flag”.

Step 3. Put CrossBand onto Detail. Set InstanceCount property equal to desired columns count. Set binding CrossBand.Visible to “flag”.

Step 4. Write down the following script for CrossBand.GenerateScript property:

if (Engine.DataNavigationManager.GetNavigator(dataBand1.DataSource)
    .HasMoreItems) 
{ 
  if (crossBand1.LineNumber % rowsCount != 0)
  { 
    Engine.DataNavigationManager.GetNavigator(dataBand1.DataSource)
    .MoveNext();        
  }
} 
if (!Engine.DataNavigationManager.GetNavigator(dataBand1.DataSource)
    .HasMoreItems) 
  flag = false;

Step 5. Put TextBox onto the CrossBand and set TextBox.Value property to get data from DataSource. For example, textBox.Value = "Rec " + dataBand1["number"]

The template may look like this:

The final report will look like the following:

Add Feedback