Skip to Content
author's profile photo Former Member
Former Member

grouping but dynamic sorting

I am grouping my records based on one field, say TestID, but I want the report can be sorted according to a prompt parameter, say TestID,TestName or TestLocation, assuming both at the same grouping level.

The output is like this

TestID1 | TestName1 | TestLocation1
                                    UserID | UserName
                                    UserID | UserName

TestID2 | TestName2 | TestLocation2
                                   UserID | UserName
                                   UserID | UserName

I am using XI R1. Thanks for any advice.

Edited by: Peter Wang on Sep 24, 2008 12:28 AM

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

1 Answer

  • Posted on Sep 23, 2008 at 10:48 PM

    Hi Peter,

    I'm not sure I understand the question completely, however from what I'm interpretting you could create a parameter field and a formula in Crystal Reports. For example,

    - create a string parameter named "SortParameter".

    - create a formula named "SortFormula".

    In the formula you would enter similar text:


    if {?SortParameter} = 'TestID' then {testID.field}


    if {?SortParameter} = 'TestName' then {testName.field}


    if {?SortParameter} = 'TestLocation' then {testLocation.field}

    - next you would Insert|Group and select your {@SortFormula} field to group on.



    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.