Wednesday, November 19, 2014

Sorting in Crosstab report Crystal Report

Scenario: 
Sorting data in crosstab on the basis of invisible column in the dataset/table which is attached to report. Image 1 is the image without sorting. It is sorted by report engine automatically on the basis of first column which is description. But we do not want the sorting of report on the basis of description and description is sorted alphabetically. Image 2 is showing the design of the report. You can notice that description is the primary field there. So report is sorted on this field.



Image: 1


Image: 2

Solution:
Following are the steps:
Step 1: Open report designer and right click and select "Cross-Tab Expert..."


Step 2: You will see the Rows part and currently in my case i have two columns as rows description and date.


Step 3: As reports is being displayed description wise which is not required. There is a serial number field in table and report should be displayed according to it. So Select "Description" and click "Group Options...". There will be a dialog. So have to do some changes in it.


Step 4: Click the drop down and select SR_NO (serial number)



Step 5: SR_NO is selected in the image because you can see that there is mentioned that "the records will be sorted and grouped by:" So we are changing sorting here. :)



Step 6: Click the next tab "Options". Here we can customize the group name. By default this is unchecked as you can notice here.


Step 7: Check this checkbox and select the field for display and grouping which is description here



Step 8: Click "OK" and "Description" field will be replaced with "SR_NO"


Step 9: Now print the report and you can notice that report is sorted in SR_NO (serial number) instead of "Description" and display field is "Description"