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 biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

sorting a string

Status
Not open for further replies.

sorchard2000

Technical User
Aug 3, 2004
57
US
Hello!
Crystal 8.5, SQL Server

I have a report where I made a group from existing surgery rooms
OR 1, OR 2....on until OR 10. Crystal sees this as a string.

(I put this field in group footer #1.) When the report prints out, the listing goes as follows:
OR 1
OR 10
OR 2
OR 3
etc...

I need the report to have OR 10 listed as last. I've looked in all the usual formatting places and just can't seem to get it to work. I know this is probably very simple but I can't seem to figure it out.

Thanks for any help given!

sorchard2000
 
Instead of grouping on the surgery room, you could use a formula that removes the 'OR' part, leaving the resulting room # as the field to group on. That would take care your sorting. For example, create a formula like this:

//@RoomNumber
//This assumes that the format of the field is "OR ##"
Val(Split({Table.RoomNumber}, " ")[2]);

In the report, instead of grouping on the actual field, change the group to use the above formula (or some other varian). The end result should be the Surgery Room group sorted by the actual room number.

-dave
 
Thanks for your quick reply!
I tried that formula but forgot that I have a LOT of formulas based on that group name. So my other formulas aren't going to work with this new formula. I know I can change the other formulas but was wondering if there is any other way around this?

Thanks
sorchard2000
 
You could also use go into report->change group expert->your OR group->options->specified order and then use the dropdown to add the groups in the desired order. If you really have only 10 rooms, and there would always be 10 or less, then this would be simple to do and workable.

-LB
 
Another option would be to use the Change Group Options screen to set the sorting to 'specified order', then type in the order you want the room #'s to show. If you only have 10, then that's not really a big deal, but if you have several different possible rooms, that would be a pain.

-dave
 
Thansks to both of you!
I knew that option was somewhere but I couldn't remember where!

It worked perfectly!

Thanks!

sorchard2000
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top