Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Group Sort Using Formula

Status
Not open for further replies.

jduryea

Programmer
Nov 8, 2011
2
US
Using Crystal Reports XI, is there a way to sort a group in a specified order or ascending order depending on the value of another field?

I need to sort a group called Goals in a specific order when another field called Business Unit is a certain value, otherwise I want the group Goals to sort ascending.

The Business Unit field has only one value each time the report is run. Different business units want their information sorted in different ways.
 
Let's say Goals has instances of A, B, and C and that BusinessUnit has instances like x, y, z.

Create a formula like this:

select {table.BusinessUnit}
case "x" :
(
select {table.Goals}
case "A" : 1
case "B" : 3
case "C" : 2
)
case "y" :
(
select select {table.Goals}
case "A" : 3
case "B" : 2
case "C" : 1
)
default : {table.Goals}

Insert a minimum on this at the Goals group level and then do a group sort using the formula and choose ascending order.

-LB
 
That works well. I appreciate your help.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top