CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2
  1. #1
    Join Date
    May 2016
    Posts
    1

    How to to custom sorting based on row values?

    Hi all,

    I am a brand new user of crystal report and I am trying to do a custom sort of a report based on the row values.
    eg:

    Products
    -------------
    Television HD
    Home Theatre type 1
    Music system type 1
    Television
    Home Theatre type 2
    Music system type 2

    I want the report to be sorted like below:

    Products
    -------------
    Television HD
    Home Theatre
    Television
    Music system type 1
    Home Theatre type 2
    Music system


    Please let me know how this can be achieved.

    Thanks in advance!

  2. #2
    Join Date
    Aug 2007
    Posts
    179

    Re: How to to custom sorting based on row values?

    You can force a sort order using a formula like...
    Code:
    if {TABLE.Products} = 'Television HD' then 'A'
    else
    if {TABLE.Products} = 'Home Theatre type 1' then 'B'
    else
    if {TABLE.Products} = 'Music system type 1' then 'C'
    else
    if {TABLE.Products} = 'Television' then 'D'
    else
    if {TABLE.Products} = 'Home Theatre type 2' then 'E'
    else
    if {TABLE.Products} = 'Music system type 2' then 'F'
    else 'G'

Posting Permissions

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





Click Here to Expand Forum to Full Width

Featured