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

Regrouping a population

Status
Not open for further replies.

luxvivens

Technical User
May 20, 2010
27
CA
I receive a list of about 1000 indivudals/month and an individual may fall into one or multiple populations (e.g., let's call the populations ABC and DEF and GHI and JKL). I need to provide a consilidated list of these individuals so that the individuals are not listed multiple times. That is, I don't need JOhn Doe reported four times.

I want to see John Doe listed once (one row) as belonging to population ABC, DEF, GHI and JKL and so on. With a smaller population size I could more easily just sort by patient name and population type and re-tally.

This type of inquiry has no doubt been asked before. I am using CR10. I was thinking some count function or some use of section headers or footers might be useful. Any ideas or suggestions would be appreciated. I'm a neophyte with this.

Here is an example of input and output desired. Many thanks.

Name Population
John Doe ABC
John Doe DEF
John Doe GHI
John Doe JKL
Sue Gant ABC
Sue Gant GHI
Sue Gant JKL
Bob Ott DEF
Bob Ott JKL
Carol Penn GHI
Doug Gore DEF
Doug Gore GHI
Barb Dunn DEF
Barb Dunn JKL

Desired Output:
Name Population
John Doe ABC DEF GHI JKL
Sue Gant ABC GHI JKL
Barb Dunn DEF JKL
Bob Ott DEF JKL
Carol Penn GHI
 
I do not have crystal in front of me, so apologize in advance for any errors.


i would first group on Name.
in the details section use an accumulation formula something like:
{@Accum}
stringvar acc;
IF {table.name} = Previous({table.name})
THEN acc := acc & {table.population}
else acc := acc;

place a reset formula in the group header:
{@AccumReset}
stringvar acc := "";

place the display in the group footer:
{@AccumDisplay}
stringvar acc;
acc
 
Each formula needs to begin with: "whileprintingrecords;". The accum formula does not need to test for previous values, since you are grouping on the name to begin with:

whileprintingrecords;
stringvar acc;
acc := acc & {table.population} + " ";

-LB
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top