Report Design
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Report Design
Message Icon Topic: Sorting Data in a Report Post Reply Post New Topic
Author Message
Chels2983
Newbie
Newbie
Avatar

Joined: 15 Jul 2009
Location: United States
Online Status: Offline
Posts: 5
Quote Chels2983 Replybullet Topic: Sorting Data in a Report
     Posted: 15 Jul 2009 at 8:06am
I have been working on a report in which I am trying to sort certain types of data that is located within the same table and field.  The data is distinguished and may be sorted according to a particular "analysis code." 
 
For example, I would like for all of my sample data, which is defined by the analysis code "TOC_," to appear at the top of the details section of the report.  However, I would like for my QC data for that particular sample, which is defined by the analysis code "TOC_LCS," to be located at the bottom of the details section of the report.       
 
I'm sure there is a formula that might help with this sorting or placing of data, but I'm not sure how to go out about creating that formula.
 
If {FLATDATA_1.ACOD} = "TOC_LCS" then . . .
 
Any help or suggestions would be greatly appreciated.
 
Thank you,
 
Chelsey  
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 15 Jul 2009 at 8:36am

Your final formula would depend on how many different options are in the {FLATDATA_1.ACOD} field that you need to handle but you can go down the path you started. Create the formula field and then do a primary Sort on it. You can add a secondary sort to further refine it if needed. The below example would give you a sort process as you described with a final else to include all the other {FLATDATA_1.ACOD} options that are not = to TOC_ or TOC_LCS which presumably will be between those 2 options.

If {FLATDATA_1.ACOD} = "TOC_" then "_" else
If {FLATDATA_1.ACOD} = "TOC_LCS" then "Z" else {FLATDATA_1.ACOD}


Edited by DBlank - 15 Jul 2009 at 8:38am
IP IP Logged
Chels2983
Newbie
Newbie
Avatar

Joined: 15 Jul 2009
Location: United States
Online Status: Offline
Posts: 5
Quote Chels2983 Replybullet Posted: 15 Jul 2009 at 9:05am

That formula is great!  Thank you so much for the super quick response!  That worked as far as getting the sample with the analysis code "TOC_" at the top and the data with analysis code "TOC_LCS" right below it.  However, I was really wanting to distinguish the "TOC_LCS" data more by having it appear at the bottom of the page or report.  Right now, there is nothing to really set apart the "TOC_LCS" data from the "TOC_" sample data.  Is it possible to have a formula that would allow you to put some, but not all, of certain data within a field at the VERY bottom of the details section or within the page footer maybe?     

IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 15 Jul 2009 at 9:14am

This really depends on how you need it to be displayed. Do you need it to remain in a row type of view or do you want it to appear in a long text string.

If you want it to be a row based I would recommend adding a Sub report to the Report Footer.
If you want it to appear as a long string you can use a variable to convert it to that format and insert the result variable int the report footer. Either case you can conditionally suppress the detail rows in the main report where {FLATDATA_1.ACOD} = "TOC_LCS".
IP IP Logged
Printable version Printable version

Forum Jump
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot delete your posts in this forum
You cannot edit your posts in this forum
You cannot create polls in this forum
You cannot vote in polls in this forum