# Sorting groups in Crystal reports 2008

I have a Crystal Report that is grouped by Codes for example
RVGBP
MPSTG
TRGBP
LASTG

Is there a way to order the groups so that the group starting with TR always appears first, then all the others, and then the group starting with RV last? I have no way of knowing what all the in between groups will be called so I cant pick them out and use the specified order in the group expert.

many thanks for any help
###### Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Commented:
Hi,

try this formula

``````if {grp.id} like "TR*" then
1
else if {grp.id} like "RV*" then
999
else
2;
``````
Then use the formula in
Insert Group -> Use a formula as group sort order.

Regards
0

Experts Exchange Solution brought to you by

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Commented:
I could be wrong, but I think Rgonzo1971 is suggesting that you use that formula to sort your current group.  Older versions of CR don't have that option, but I think I read that newer versions do.

If so, another option would be to create a formula like the one that Rgonzo1971 posted and create a new group on that formula, above the current group.  Or maybe I misunderstood and that's what he was suggesting in the first place.

James
0
Author Commented:
Hi

Thank you so much for your replies. If I use the first solution
if {grp.id} like "TR*" then

1
else if {grp.id} like "RV*" then
999
else
2;

Will this not group everything that is not TR and RV into one group?

Very much appreciated

Dawnyanne x
0
Commented:
The solution suggested is to use that formula as the sort formula for the groups.

You may have to group on that formula then group on the field you are using.

THe problem is you can setup the specified order to get the first few in order but you can't specify which is last.

mlmcc
0
###### It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Crystal Reports

From novice to tech pro — start learning today.