Vb.net – How to sort field values in specified order in crystal reports in visual studio 2005

crystal-reportsvb.netvisual studio

I am using crystal reports in visual studio 2005 to generate invoices. I want to sort different categories of products. I'm using group by on category field. How can i set a specified order in crystal reports for categories.

I have for example 3 categories namely 'Recipe', 'Plain Spices', and 'Horeca'….The crystal reports shows them in ascending or descending order but i want Recipe data at top, then Plain Spices and Horeca in the end…!!

How can I achieve this in my crystal report that has already been made??

Best Answer

To clarify the other answer - you need to change the sort order from ascending (or descending) to specified order. To do this:

  1. Right-click in the grey area to the left of the page layout for the relevant group header (or footer) and select Change Group... .
  2. In the Common tab of the Change Group Options dialog, change the selected sort order from "in ascending order" to "in specified order". A new tab headed "Specified Order" will open in the dialog.
  3. In the Specified Order tab, select each of the required categories from the Named Group dropdown and add them to the list of specified groups in the desired order. (You can adjust this order with the arrows immediately to the right of the list.)
  4. When the list of categories is in the desired order, click OK at the bottom of the Change Group Options dialog and preview the output. This should now appear in the desired order.