Report Design
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Report Design
Message Icon Topic: Sort using parameter not group Post Reply Post New Topic
Author Message
south
Groupie
Groupie


Joined: 31 Jul 2012
Online Status: Offline
Posts: 82
Quote south Replybullet Topic: Sort using parameter not group
     Posted: 17 May 2013 at 6:07am

Hello everyone,

I am trying to get my report to use a parameter as my sort option. I would like it to sort in date order or by the difference in dollars.
 but I cannot figure out why it's not working.
my formula is:
if {?Sort Option} = '1' then ToText ({date.field}, "yyyy-mm-dd") else
if {?Sort Option} = '2' then GroupName ({@dollardiff})
I put this formula in my report header.  When I go to sort expert my formula Sort Option is not even one that is listed as a field to choose.  What am I doing wrong??
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 17 May 2013 at 6:52am
what is the dollardiff formula?
depending on how it is written it may occur in a pass that happens after sorting so it will not be allowed to be used as a sort field.

Edited by DBlank - 17 May 2013 at 10:49am
IP IP Logged
lockwelle
Moderator
Moderator


Joined: 21 Dec 2007
Online Status: Offline
Posts: 4374
Quote lockwelle Replybullet Posted: 17 May 2013 at 11:17am
I don't know about the sort options...since I never use them, but what you can do is create a group, and use the formula as the grouping criteria.

Though as DBlank mentioned, if the data in the dollardiff formula is not 'intrinisically' in the data...ie CR can't just subtract 2 fields from each other in the same row it won't work.

Because as DBlank mentioned, if the computation cannot be done before the writing of records to the report, CR cannot group/sort...really do anything like that as the values are not there.

HTH

I probably got that as clear as mud.
IP IP Logged
south
Groupie
Groupie


Joined: 31 Jul 2012
Online Status: Offline
Posts: 82
Quote south Replybullet Posted: 20 May 2013 at 4:42am

The formula for dollardiff is the difference between actual and estimated dollars.  I never considered that the formula would calculate after the sort.  That makes sense.  Thank you both for your assistance, I thought it was something that I wasn't doing correctly.

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