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

Specified Order Grouping

Status
Not open for further replies.

GodSend

Programmer
Aug 5, 2003
5
CA
I have created 5 groups : East, South, West, Mid-West, and Canada in Crystal Reports using the Group Expert a giving it a specified order (where each group mentioned above sorts on the condition "is one of" refereing to state abbreviations.


I got this group to work fine, however I could not figure out how to get it to sort by state (it appears as though you can not so a record sort by the same field which you are grouping on?).

In order to get past this I thought I would add a sub group which would sort by state.

My problem is that no matter what options I have set (specifically the "keep group together check boxes") I keep getting the following situation

[+]East
- CT
- CT
- MD
- NY
- CT

Each of these sub groups may or may not have multiple records. In addition, if I were to look at the first CT field for example, not all of the states will be CT, some will be MA or VA for example.

Please help! All I want to do is group on state (into E,S,MD,W, and Canada) and then have the records inside those groups sorted by state.

Thanks in advance.
 
What specific field are you using for sorting and grouping? You can't be using a state field and still get other states within the group...

-LB
 
Currently I am grouping based upon the state field (using my own specified group). I am sorting via ID, but only because I can not figure out how to get each group sorted by state (if that makes any sense).
 
I think if u setup your fields so u group on the ID and then u could sort the states within the ID groupings

BM
 
Please provide specifics or no one will be able to help. For example, how did you define your specified groups? If you did it by formula, it would look something like:

if {table.state} in ["MA","NY","VT","ME","NH","CT","RI"] then "Northeast" else
if {table.state in ["AK","CA","OR","WA"] then "Pacific Coast" else
//...etc.

And what is your state field--is it literally a two-letter string? Or is it an address field that contains other information?

-LB
 
- The states are literally a two letter string.
- The grouping is not based on a forumlar, but rather straight through the Group Expert (although your code very closely approximates what I imagine is going on).

As a side note, I solved the problem by creating an inner group that expliciatly forces each record into a group based upon a "is equal to" clause.

Simple as that, but I needed to create 51+ conditions.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top