SAP Knowledge Base Article - Public

1541427 - How to Dynamically group a Crystal Report based on Parameter object

Symptom

  • Create a Crystal Report which prompts the user to choose the Database field on which Grouping is to be done
  • Create Group in Crystal Report based on Parameter Object

Environment

Crystal Reports 2008

Resolution

  1. Open Crystal Reports Designer and connect to "Xtreme" sample Database
  2. Add "Customer" table to Report
  3. Create a Parameter Object which prompts User To Choose Database Field For e.g. "Country" or "Region"
  4. Create following formula named "test formula" to Dynamically choose Database field based on value selected in Parameter                                                                                     

                         Whilereadingrecords;                        

                         If {?parameter} = "Country" then {Customer.Country}

                         If {?parameter} = "Region" then {Customer.Region}

     5.   This formula will return the Database field based on user's selection.

     6.   Open "Group Expert"

     7.   Group by "test formula"

Keywords

Dynamic Grouping,Crystal Reports, Grouping , KBA , BI-RA-CR , Crystal Reports designer or Business View Manager , How To

Product

SAP Crystal Reports all versions