How to create report with dynamic columns or variable columns
To create a report with dynamic or variable columns in Bold Reports®, use code modules with a multi-value parameter to change the order or presence of report columns based on specific conditions and parameters. Users then control the report layout, which makes the report columns more flexible.
To create dynamic columns in your report, follow these steps:
-
Using the code modules, define a function that returns the order columns value for a specific column based on a given parameter value and order name. The following is an example of a VB function that does this.
Public Function GetColumnValue(ByVal columnNum as Integer, ByVal parameter as Parameter) as String Return parameter.Value(columnNum-1) End Function -
Create a multi-value parameter for specifying the order of the columns in the report.

- Specify the column names in the default section of this parameter for the table column order.

- Set the table’s header row expression using the code module, as in the following image:

```vb
=Code.GetColumnValue(1, Parameters!Order)
```- Set the expression for the details row in the table using the code module, as in the following image:

```vb
=Fields(Code.GetColumnValue(1,Parameters!Order)).Value
```- The report output is ordered based on the order sequence parameter, as in the following images:

