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!

Easy Grouping Question

Status
Not open for further replies.

ebutter

Technical User
Feb 17, 2005
77
0
0
US
Hopefully this is an easy one. When using Groups on a report I can't find a way other then using subreports to add more then one grouping "cluster". If I add more groups Crystal creates a grouping hierarchy. Is there any way to segregate groups into different sections? Thanks!
 
You would assign each record a 'clusterid' and then use that as the highest grouping level.
 
To expand on that, you could create a formula like:

if {table.groupfield} in ["A","G","P"] then 1 else
if {table.groupfield} in ["B","K","Z"] then 2 else 3

Then insert a group on this formula and go to the change group expert and use the direction key to make it your topmost group.

-LB
 
I don't quite get it. If I do this:
if {table.groupfield} in ["A","G","P"] then 1 else
if {table.groupfield} in ["B","K","Z"] then 2 else 3
and put it at the top of my group hierarchy does it create 3 groups that act independently? Also, what do the parameters ["A","G","P"] refer to? Could I just say,

if {table.groupfield1} then 1 else
if {table.groupfield2} then 2 else 3 ?

To clarify, this gets me groups that are independent of each other? They don't interact in any way?

Thanks!
 
In order to 'separate' the groups as you originally had them you must use another grouping level which is above any existing groups and which you have referred to as a 'cluster' in your Q.
You must have some rule that you use to decide which cluster any record belongs to. This is presumably a field on the input data.
lbass's example was simply illustrating the sort of code you need to use to allocate a 'cluster number' to each record. You would use your own values instead of A, G, P etc.

 
Maybe we are misinterpreting your goal here. Are you really trying to cluster sets of groups into a higher order group? Or are you trying to present the same data with two different kinds of groupings. I think you should supply some sample data that demonstrates what you hope to do.

-LB
 
If a given record can exist in more than one cluster, then it will be grouped with the first (or is the last) cluster condition it finds. Otherwise, you will have to use subreports.

Cheers,
-LW
 
I am trying to present different data which is summarized in 4 different group "clusters". For instance,

Assets
Asset Category
Details

Income
Income Type
Details

Estate Distribution
Asset Type
Details

In the above example I have 3 of what I'm calling "clusters". They are Details roll-up into the two groups above. My question is, Can I do all of this on one report or do I need to make each of these "clusters" as a subreport?

Thanks!
 
Are assets, income, and estate distribution all instances of one field? If they are, then you could group on that field, but that seems unlikely. You probably do need to use separate subreports for each.

-LB
 
On the surface, it looks like subreports to me. Make one the main report and add the others as subreports.

This is what I did for my monthly report. One set of data but grouped and summarized differently.

-LW
 
Thanks for all your help-- subreports it is. This is the most active forum I've ever seen!
 
In quickly going over this thread, some basic misunderstandings exist about Crystal.

First, a Group is akin to a SQL group, they are not seperate entities and are always nested.

In your posting you state "In the above example I have 3 of what I'm calling "clusters". They are Details roll-up into the two groups above. My question is, Can I do all of this on one report or do I need to make each of these "clusters" as a subreport?"

It appears to me that you have 3 separate groups, perhaps you should take LB's excellent suggestion and supply sample dtaa and expected output rather than trying to describe it with text. You supplied output, but not what the output is based on, that makes it hard to properly advise you.

In general, create a mini-spec, as in:

Crystal version
Database/connectivity used
Example data
Expected output (based on the example data)

-k
 
I work for a hospital writing reports from our clinical system. Here's my problem...I am gathering data on single patients that include their MD's name. The MD's are classified by their type ie., Admitting, Attending and Consulting. They may be all of these, two of these, are only one of these types. I need to only have them listed one time. What they do now is if they are more than one type, they are listed for each type. If I do only one type such as Attending (see below) then I miss the MD if they are only consulting. I need a formula that will list them only once no matter what their type is.
I hope this makes sense.

{ptsmds.md_name} like ['*SMITH*','*JONES*','*DOUGLAS*'] and
{ptsmds.type} like 'Attending'
 
Looks like your question is in the wrong place. You need to insert this in a new thread.

EB
 
To answer sjc1956's question, is it one record with three types for an MD, or one record per type?

If it is one record, do a formula field that checks and chooses the most relevant.

If it is several, you'd need to group by MD.

[yinyang] Madawc Williams (East Anglia, UK) [yinyang]
 
PS, I agree this is the wrong place to post it. A new thread is always best, even if the query is similar. You can refer to the old one if it is relevant.

[yinyang] Madawc Williams (East Anglia, UK) [yinyang]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top