Report Design
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Report Design
Message Icon Topic: Formula to show High, Med & Low Post Reply Post New Topic
Author Message
dawnh44
Groupie
Groupie


Joined: 25 Sep 2011
Online Status: Offline
Posts: 79
Quote dawnh44 Replybullet Topic: Formula to show High, Med & Low
     Posted: 12 Jun 2012 at 3:35am
Hello,
 
I have the field a1_total.  This field may or may not have 3 cost comparisons associated to a request.  I'm trying to create a formula that will show High, Medium, Low when there are 3 costs associated to a request.  If there are only 2, then I would like it to show High and Low.  If there is only one cost associated to the request, then I would like it to say 'N/A'.  I began my formula like the following:
 
if Maximum ({@total_save}) then 'H'
else if Minimum ({@total_save}) then 'L'
else 'M'
 
I'm getting a message stating that it's expecting a boolean.  Does anyone have an example of what I'm trying to accomplish?
 
Thank you.
IP IP Logged
hilfy
Admin Group
Admin Group
Avatar

Joined: 20 Nov 2006
Online Status: Offline
Posts: 3702
Quote hilfy Replybullet Posted: 12 Jun 2012 at 3:54am

You're getting the error because you're not comparing the max and min to anything.  You might need to do something like the following:

if Maximum({@total_save}) = Minimum({@total_save}) then 'N/A'
else if {@total_save} = Maximum({@total_save}) then 'H'
else if {@total_save} = Minimum({@total_save}) and then 'L'
else 'M'
 
-Dell
IP IP Logged
dawnh44
Groupie
Groupie


Joined: 25 Sep 2011
Online Status: Offline
Posts: 79
Quote dawnh44 Replybullet Posted: 12 Jun 2012 at 4:12am
Thank you.  I have tried doing something similar to that.  I've added in a group that shows me the amounts for total_save.  Please see the following formula:
 
if Maximum ({cq_letter;1.a1_total(1)}) > Minimum({cq_letter;1.a1_total(1)}) then 'H'
else if Minimum ({cq_letter;1.a1_total(1)})< Maximum ({cq_letter;1.a1_total(1)}) then 'L'
else 'M'
 
Now, it's putting 'H' next to everything.  Does anyone have any other ideas that could help?
 
Thank you.
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 12 Jun 2012 at 4:43am
use Hilfys suggestion directly
Your first statement...
Maximum ({cq_letter;1.a1_total(1)}) > Minimum({cq_letter;1.a1_total(1)}) then 'H' ...
is almost alwasy going to return a TRUE. The only time it won't is when there is only one value for the total.
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