Report Design
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Report Design
Message Icon Topic: Sort data by highest % Post Reply Post New Topic
Author Message
Robotacha
Groupie
Groupie
Avatar

Joined: 11 Nov 2009
Location: United Kingdom
Online Status: Offline
Posts: 97
Quote Robotacha Replybullet Topic: Sort data by highest %
     Posted: 12 Sep 2011 at 10:22pm
Hello,
 
Can anyone help me please?
 
I have a very simple report, and I need to sort it descending by a
%formula I have created.
 
 
I only have 1 group and 4 fields in the report (2 of the fields are formulas):
 
formulas:
 
@target:
IF {TABLE.PRODUCTCODE} = "example1" THEN 200 ELSE
IF {TABLE.PRODUCTCODE} = "example2" THEN 150 ELSE
IF     etc............
 
@%oftarget:
IF Sum ({TABLE.QTY}, {TABLE.PRODUCTCODE})=0 THEN "0.00%" ELSE
(Sum ({TABLE.QTY}, {TABLE.PRODUCTCODE})/{@target})*100 & "%"
 
 
 
my report is:
 
Grouped by PRODUCT CODE,
 
then QUANTITY summarized by PRODUCT CODE group
 
Drop my formulas in, and it returns results like this:
 
GROUP1      @TARGET       QTY(sum)         % of Target
example 1        200                 100                     50%
example 2        150                 165                   110%
example 3        300                   30                     10%
 
 
When I look in the group sort expert, or the reord sort expert, It does NOT show my %oftarget formula so I can sort it descending.
 
 
Can anyone advise on what I am doing wrong? or how to achieve it?
 
 
 
Regards,
 
Mike
 
Regards,

Michael Jones
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 13 Sep 2011 at 4:17am
these are group summaries so are not available to be used to sort rows.
If you can use the insert sumamry functionyou can use the Group Sort TOP N option.
Rethink the difference in your presentation formulas for percetnages which cannot be used for siorting and just using its source summary for sorting (Sum ({TABLE.QTY}, {TABLE.PRODUCTCODE}) descending)
IP IP Logged
Robotacha
Groupie
Groupie
Avatar

Joined: 11 Nov 2009
Location: United Kingdom
Online Status: Offline
Posts: 97
Quote Robotacha Replybullet Posted: 13 Sep 2011 at 4:29am
Thanks for the reply.
 
As Each productcode has a different target,  Its not really viable for me to sort by quantity alone,
 
We need to monitor performance by highest % against target.
 
ok, ill have to re-think this one!
 
Again, thanks for the reply :)
 
 
Regards,

Michael Jones
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 13 Sep 2011 at 4:58am

if you can get some value using the insert summary function that gets to the correct order (not necesarily display value) you are good to go. Otherwise there is no way that I know of to a dynamic group sort.

IP IP Logged
Robotacha
Groupie
Groupie
Avatar

Joined: 11 Nov 2009
Location: United Kingdom
Online Status: Offline
Posts: 97
Quote Robotacha Replybullet Posted: 22 Sep 2011 at 1:09am
I choose to use excel instead :( PDF looks so much better, but oh well.
 
I wrote a VB macro to sort the data, add all my images, blah blah....
 
works a treat now. I Would have preferred it to be fully automated and emailed direct to the relevant people, but, it only takes seconds to click a macro button and send to mail recipient :)
 
 
Regards,

Michael Jones
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