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

Sorting & Grouping

Status
Not open for further replies.

isoft

Programmer
Apr 3, 2001
14
AU
Hi, i have a list of data as follows -

T1 08:00 Aardvark
T1 08:30 Aardvark
T1 09:00 Zebra
T1 11:30 Lion
T2 08:00 Aardvark

I need the data sorted as shown above and reported as follows, but am having trouble in getting the results i need.

Aardvark
T1 08:00 Aardvark
T1 08:30 Aardvark
Total 2

Zebra
T1 09:00 Zebra
Total 1

Lion
T1 11:30 Lion
Total 1

Aardvark
T2 08:00 Aardvark
Total 1

Any help/advice/thoughts most appreciated!
 
So you want to show T1s before T2s, that part is easy.

Why do you want the order within the T1s to go Aardvark, Zebra, Lion as oppossed to a simple alphabetic order? What are the rules? Software Training and Support for Macola, Crystal Reports and Goldmine
251-621-8972
dgilsdorf@mchsi.com
 
Create a Group on the T1 field that will sort correctly:

val(mid({MyTable.MyTField,1}))

This assumes that you always have just the letter T starting the field. The reason I convert to a number is in the case that you reach T10, which would incorrectly sort before T9 were it to remain a string.

Create a subgroup for the Animal field.

Make sure that your time field is a time (not a string) by using the following in a formula:

time({MyTable.MyTimeField})

Add sorting for this time field.

Add your fields to the detail line.

Now you can right click the animal field and do an Insert-Summary->subtotal->Count for the T1 group.

-k kai@informeddatadecisions.com
 
Hi dgillz,

The secondary sortation after the T's is by time, i need to show the day broken up by doctor name, but still kept in chronological order. So the time needs to be my next grouping in this instance.

Hi SynapseVampire, As soon as i try to group by name i lose the time sequencing.

PS new to crystal, but not new to report writing!!
 
What if youhad another record: T1, Aardvark, 11:45? Would it show up at the bottom of the T1s or with the other two T1 Aardvard records? Software Training and Support for Macola, Crystal Reports and Goldmine
251-621-8972
dgilsdorf@mchsi.com
 
If that event was to occur then it would be at the bottom of the T1's as a new group as such. eg

Lion
T1 11:30 Lion
Total 1

Aardvark
T1 11:45 Aardvark
Total 1

Aardvark
T2 08:00 Aardvark
Total 1
 
Your first 2 aardvarks have different times, yet are in the same group, but when you add another aardvark of a later time, you want it to be in a separate group?

What would you want happen if you had yet another aardvark T1 with a time of 9:00?

I am having troubling with the rules here. Software Training and Support for Macola, Crystal Reports and Goldmine
251-621-8972
dgilsdorf@mchsi.com
 
I think I have got it. He wants the T1 Groups first, then T2. Nested below that he wants it by time . The name order is not significant.

So in the scenario you have here

T1 (Group Header 1)
08:00 Aardvark (Group Header 2)
08:30 Aardvark (Group Header 2)
09:00 Aardvark (Group Header 2)
09:00 Zebra (Group Header 2)
11:30 Lion (Group Header 2)
T2 (Group Header 1)
08:00 Aardvark (Group Header 2)

I would then do separate formula fields for Aardvard, Zebra and Lion to count them in the Group Footer 2 but maybe someone else has a better idea.
Learn something new every day *:->*
 
All this relates to theatre booking times during the day, so we wont get two doctors in the same theatre at the same time(hopefully!!). Hence i need it sorted by theatre first (Tx) then by time, grouping/counting the sessions by doctor name. So a typical day could look like...

T1 08:00 Aardvark
T1 08:30 Aardvark
T1 09:00 Zebra
T1 11:30 Lion
T1 13:00 Lion
T1 13:30 Lion
T1 14:00 Lion
T1 15:00 Aardvark
T1 15:30 Aardvark
T1 16:30 Aardvark

So the report needs to show...

Aardvark
T1 08:00 Aardvark
T1 08:30 Aardvark
Total 2

Zebra
T1 09:00 Zebra
Total 1

Lion
T1 11:30 Lion
T1 13:00 Lion
T1 13:30 Lion
T1 14:00 Lion
Total 4

Aardvark
T1 15:00 Aardvark
T1 15:30 Aardvark
T1 16:30 Aardvark
Total 3

Hope this clarifies things.
 
The only problem I have with this is how to get the separate groups of aardvarks. All of the aardvarks in your example are T1.

Unless you can give me a hard a fast set of rules of how to differentiate the first group from the subsequent groups (I also assume a third or even fourth group is possible), then I do not know how to help you.

How about just a listing of the items in chronological order, with a recap my animal at the end? That is easy. What you are asking for I do not know how to do. Software Training and Support for Macola, Crystal Reports and Goldmine
251-621-8972
dgilsdorf@mchsi.com
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top