Dani AM
Dani AM

Reputation: 67

hide columns in crystal report at run time?

how to hide columns in crystal report at run time? thanks for any suggistions.

Upvotes: 4

Views: 12316

Answers (3)

Dani AM
Dani AM

Reputation: 67

just for sharing I found a great and simple article at

http://www.codeproject.com/KB/cs/Dynamic_Crystal_Report.aspx

that using parameters in crystal report to dynamically load data from a database into Crystal Report and show specifying which field (Columns of a particular table) should be displayed in the repor according to user choice.

Dani.

Upvotes: 0

craig
craig

Reputation: 26272

Option 1: use conditional-suppression logic to hide/show redundant fields

Use a parameter field to drive the suppression formulae for the desired fields.

If you want to eliminate blank spaces between fields, then you'll need to stack the fields on top of each other and suppress them appropriately. In your example, column 2 would contain field2 and field3 (both suppressed) and column 3 would contain field2 and field3 (both suppressed). The suppression logic, in your example, would continue to suppress both fields in column 2, but would show field3 in column 2 (field2 in column 2 would still be suppressed).

Option 2: use 'placeholder' formula field

Each column of data that could be suppressed would be a formula field. Each formula field would use SELECT CASE logic to choose the desired field to display. A 'hidden' field would simply return a null value. Your SELECT CASE logic would be written to ensure that values are filled from left to right. The formatting will need to be done in the formula rather than on the formula field itself.

Option 3: use the SDK to dynamically-change the report.

Use the CR .Net SDK or the older CRAXDRT API to dynamically-modify the columns' visibility and positioning.

If you use this option, however, your deployment options will be more restricted.

Upvotes: 2

Jojo Sardez
Jojo Sardez

Reputation: 8578

You could use parameters (which values can be set during runtime) and use them on the objects' suppress formula.

Upvotes: 0

Related Questions