Report Design
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Report Design
Message Icon Topic: Sequential order of a Grouping Post Reply Post New Topic
Author Message
wentz6971
Newbie
Newbie
Avatar

Joined: 23 Oct 2007
Online Status: Offline
Posts: 3
Quote wentz6971 Replybullet Topic: Sequential order of a Grouping
     Posted: 24 Apr 2008 at 11:44am
I have a report where I have a grouping based on a formula, for example, Levels 1,2,3,4,5,6,7,8,9,10. The report does the grouping as Levels 1,2,4,5,3,6,7,8,9,10. Level 3 is after Level 5. The Group Name formula is below:
if {@Formula_Level}=1 then 'Level 1 - Rookie - 0 Credits Prior Year Total' else
if {@Formula_Level}=2 then 'Level 2 - Candidate - 1-5 credits Prior Year Total' else
if {@Formula_Level}=3 then 'Level 3 - Blue - 6-24 credits Prior Year Total' else
if {@Formula_Level}=4 then 'Level 4 - Life - 25-49 credits Prior Year Total' else
if {@Formula_Level}=5 then 'Level 5 - Green - 50-99 credits Prior Year Total' else
if {@Formula_Level}=6 then 'Level 6 - Red - 100-149 credits Prior Year Total' else
if {@Formula_Level}=7 then 'Level 7 - Royal - 150-249 credits Prior Year Total' else
if {@Formula_Level}=8 then 'Level 8 - Purple - 250-499 credits Prior Year Total' else
if {@Formula_Level}=9 then 'Level 9 - Statesman - 500-1499 credits Prior Year Total' else
if {@Formula_Level}=10 then'Level 10 - All-Time Big Spikes - 1500+ credits Prior Year Total'

Now the formula for @Formula_Level is below:
Switch (
{Command.PY_TotalCredits}<=0, 1,
{Command.PY_TotalCredits}>0 and {Command.PY_TotalCredits}<=5, 2,
{Command.PY_TotalCredits}>5 and {Command.PY_TotalCredits}<=24, 3,
{Command.PY_TotalCredits}>24 and {Command.PY_TotalCredits}<=49, 4,
{Command.PY_TotalCredits}>49 and {Command.PY_TotalCredits}<=99, 5,
{Command.PY_TotalCredits}>99 and {Command.PY_TotalCredits}<=149, 6,
{Command.PY_TotalCredits}>149 and {Command.PY_TotalCredits}<=249, 7,
{Command.PY_TotalCredits}>249 and {Command.PY_TotalCredits}<=499, 8,
{Command.PY_TotalCredits}>499 and {Command.PY_TotalCredits}<=1499, 9,
{Command.PY_TotalCredits}>1499,10
)


I have tried combinations of switch statements and if/then statements in both for formula and the Group Name Formula, but they did not fix the situation.

Any help would be greatly appreciated.
Thanks,
AW
IP IP Logged
BrianBischof
Admin Group
Admin Group
Avatar

Joined: 09 Nov 2006
Online Status: Offline
Posts: 2458
Quote BrianBischof Replybullet Posted: 24 Apr 2008 at 6:17pm
I'm assuming that the data being displayed is accurate, yes? If so, then the Switch() statement can be ignored b/c it is assigning the proper values. The problem comes down to why isnt @Formula_Level being sorted properly. I wonder it you might have an extra space in there by mistake. I doubt it, but it's worth checking. I'm guessing that something in the text is throwing it off.

I would try two things. First is to change the group options so that it sorts on a formula field. For the formula field, enter {@Formula_Level}. That way it will sort on this formula. If that doesn't work, then do a Specified Order sort. That lets you specify each description and the order it should be shown. You'll have to add an item to the list for each description you have in the report (10).

One of these methods will hopefully get you on the right path. I cover full the complete details of how to create custom groups in Chapter 3 of my Encyclopedia book. You can find out more about my books at Amazon.com or reading the Crystal Reports eBooks online.
Please support the forum! Tell others by linking to it on your blog or website:<a href="http://www.crystalreportsbook.com/forum/">Crystal Reports Forum</a>
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