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

Sorting Groups

Status
Not open for further replies.

BasilFawlty001

IS-IT--Management
Apr 26, 2002
29
0
0
CA
I have a group that is sorted Acending. In the report the group shows up about 250 times. I want to order the instances of the group by field B. I can sort inside the group, but not the groups themselves. How do I do that?
 
You sort groups with the Top-N expert. The toghest thing about Top-N reports is finding the Top-N icon. Check out your help files and it will be clear to you. Software Support for Macola, Crystal Reports and Goldmine
dgilsdorf@mchsi.com
 
The groups are sorted based on the criteria you specified when they were created, to change the sortation of the group from ascending, descending, specified order, original order:

Right click the group, select change group, then the second pulldown is how they're sorted.

I may be misunderstanding your question, but...

Groups are sorted on themselves, that's what a group is. If you need groupings based on another field, use the other field as the group. You can then display the current group field in the group header to give the illusion that it's grouped on that field.

BTW, a group will only show up one time per. If you have a group within a group, then it will appear as many times as it occurs within that group.

If none of this resolves, describe your report layout.

-k kai@informeddatadecisions.com
 
SV-

Not exactly.

If you group by customer, you might get Aarvark Corp first, and maybe end with ZZ Top Inc.

The TopN expert allows you to sort on these groups by another field, say for example total sales. This way your biggest customer, regardless of name, would be on top, #2 second, and so on.

You can look at the Top N only - and you define what N is, 10 , 25, 1000 or whatever - or you can include everything outside the top N in a group called "others". Top N reports are very cool. Software Support for Macola, Crystal Reports and Goldmine
dgilsdorf@mchsi.com
 
Right, that's what I was saying, a sum (total sales) of the group. You cannot change the group to be a field such as Field B if it's a varchar for instance.

I didn't see anything saying that they wanted them sorted by a sum of another field, if that's the case, then a Top N can work. I assumed that they misunderstood what to group by, because they wanted to display the field they grouped on.

But who knows what's really needed here.

-k kai@informeddatadecisions.com
 
SV-

Reread his original post, he wants to sort the groups by field B, not change it to group by field B. He can sort inside the groups themselves, but he cannot change the order of the groups. Hence my example of gropuping by customer, but sorting by sales (my field B).

Top N is the best way to do that that I am aware of. Software Support for Macola, Crystal Reports and Goldmine
dgilsdorf@mchsi.com
 
Basil,

I would add a summary field that is the Maximum of FieldB for each Group, and then use that summary as your TopN field. That way your records are grouped by your original field, but the groups are ordered by the FieldB value for each group. Ken Hamady, On-site Custom Crystal Reports Training & Consulting
Public classes and individual training.
Guide to using Crystal in VB
tek@kenhamady.com
 
Ok, I guess I over simplified the situation. I was hoping to avoid confusion :)

I have a database of people who sponsor children overseas and those children. They are all in the same table, in the same fields. Let's take the CONTACT Field for example. It contains first and last name of the contact, be they child or sponsor. I would like to create a report of each sponsor and the children that they sponsor. A sponsor can have multiple children but a child can only have one sponsor. The link between the two is done by field A and field B. If the number in field A (for the sponsor) = number in field B (for the child) then they are linked. For the sponsors, field B is always blank and for the children, field A is always blank. I created a formula (with some help) that creates a field with that number in it (for sponsors and children). I then created a group of CONTACT sorted by the formula field in decending order of Field A (to put the sponsor at the top). Sponsor get's bolded if Field A <> &quot;&quot; and presto I have my report.

Now the problem. I need to sort the entire list of sponsors and their children by the sponsor's name (The CONTACT field). When I got to Top N Expert I can only choose to sort by 'count of CONTACT' which I use to see if the donor is a sponsor. IE If the group contains more than 1 record, then the donor sponsors at least one child and belongs in the report. Thanks for reading my story!
 
Can one order several groups by the group headers? That would make things easy
 
Are you talking about specified order grouping? As opposed to ascending or descending order? Software Support for Macola, Crystal Reports and Goldmine
dgilsdorf@mchsi.com
 
I am talking about ordering my groups not ordering within my groups. I am able to order within the groups by decending. I don't think I ever used specified order grouping.
Here's an example. Three sponsors each with 2 kids - right now they show up like this on the report:

Billy Bob (sponsor)
sue anne (child)
mary jane (child)

Zoe Zip (sponsor)
linda lane (child)
abby adams (child)

Marky Mark (sponsor)
jimmy joe (child)
hank ham (child)

I need to order alphabeticly them by sponsor name ... like this.

Billy Bob (sponsor)
sue anne (child)
mary jane (child)

Marky Mark (sponsor)
jimmy joe (child)
hank ham (child)

Zoe Zip (sponsor)
linda lane (child)
abby adams (child)

Each set of sponsor and children are one insance of the group.
 
I got it! dgillz had it right to use the top-N expert. I created a summary of the sponsors name (since there is only one it returned the name) and used the top-N expert to sort the groups based on that. Done! thanks all of you for your time. I couln't have done it without you!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top