how to hide colum开发者_如何学编程ns in crystal report at run time? thanks for any suggistions.
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.
You could use parameters (which values can be set during runtime) and use them on the objects' suppress formula.
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.
精彩评论