2
votes

I have look through the links below:

Dynamically changing columns in Crystal Report 2008

Dynamic Columns in Crystal reports

However, it seems not suit my requirement.

So, basically, i have database fields that contains the following:

type_id | type_value
1             Test1
2             Test2

So, I would like to have the crystal report generate the columns as
Test1 | Test2
1           2

If I have changed the data as below:
type_id | type_value
1           Test11
2           Test22

The crystal report columns would react automatically:
Test11 | Test22
1               2

Any idea on how to achieve that?

Thank you!

2

2 Answers

0
votes

I would have the pivot be done in the data source instead of Crystal Report.

  1. Prepare the data table from dynamic SQL / application code doing pivot. Know the max. column you can show in the report. The output of the table like this Column1Name, Column1Value, Column2Name, Column2Value...

  2. Have your report column suppress by column name if it is null.

0
votes

use cross tab in crystal report for that purpose.

In rows put type ID and column put type value.