CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums
Results 1 to 2 of 2

Thread: Sort Group According to selection of group in crystal reports

  1. #1
    Join Date
    Nov 2014

    Smile Sort Group According to selection of group in crystal reports

    Hi All,
    I have 4 groups, namely, Customer Group, Product Group, Country and Sales Rep Name.
    I want the grouping to be done , in a way, when the user selects the Customer group as Sort By, the report should be showing results grouped by Customer-Group in Ascending Order. If the user selects ,Product group as the sort by, then result should be sorted and grouped by Product Group Only.

    I have been trying using the group sort order formula, but i am not getting the desired result. Now the output is
    like Customer Group--> product group--> Country --> Sales Rep Name
    its not one group at a time, its grouping and sub grouping. So only the customer group, grouping is coming correctly. Rest of the groups are being repeated multiple times.
    Can anyone help me to get my desired output?

    Thanks In Advance to all.

  2. #2
    Join Date
    Aug 2007

    Re: Sort Group According to selection of group in crystal reports

    Not sure what your desired output is. The Group Sort Order formula will change the order of the data in the group, it will NOT change which data is selected to be grouped. In general, you need to gather user input and control grouping and sorting. I suggest you create a numeric parameter with 4 values and 4 descriptions. Make the values and descriptions: 1= Customer, 2=Product, 3=Country and 4 = Sales Rep. Set "Prompt With Description Only" to true and "Allow Custom Values" to false. Create a new formula from the field explorer (not the group sort formula) with a case statement which follows the pattern below. The formula must return the same datatype under all cases. You then need just 1 group that is based on the formula. - good luck
    select {?My Parameter}
        case 1 :  {TABLE_CUSTOMER.FIELDX}
        case 2 :  {TABLE_PRODUCT.FIELDX}
        case 3 :  {TABLE_COUNTRY.FIELDA}
        case 4 :  {TABLE_SALESREP.FIELDB}

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Windows Mobile Development Center

Click Here to Expand Forum to Full Width

On-Demand Webinars (sponsored)