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

How to group on the letters of the alphabet? 1

Status
Not open for further replies.

gallobask

Technical User
Joined
Jun 25, 2009
Messages
48
Location
US
I am using version 8.5.
I want to grouping to show the letters of the alphabet. I do not want to base it on a field since I need ALL letters of the alphabet to display - even if I get no records returned starting with that letter. This is for a patient list report and there needs to be a header for each letter to hand write in additional patients.

Example:

A
Adam, Bob
B
Boop, Betty
C

D
Duchon, alex
Thanks for any assistance!
 
Use a formula as group

@Alpha
Uppercase(left(yoursurnamefield,1))
 
I still need the group header even if there are no field names starting with that letter... for example..
A
Adams, Bob
B
(no records returned)
C
Combs, Donna

 
You can not create data which does not exist.

You would need to create a table holding letters of the alphabet and then use a command to join this table with a left outer to the first letter of surname field.

Ian

 
Since commands aren't available in 8.5, you could do it this way--as long as you don't have outer groups. Select a table for your main report that has at least 26 records and add a field from it to your report header and suppress it. This is necessary only to activate the following formula.

Create a formula {@alph}:

whilereadingrecords;
stringvar array x := ["A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"];
numbervar i := i + 1;
stringvar y;
if i <= 26 then (
redim preserve x;
y := x
);
y

Insert a group on this formula. You should now see all 26 letters in groups.

Next insert a subreport that references the table containing patient names. Insert a group on the patient name and then suppress all other subreport sections--except the report footer (to allow for written in names), sizing the report footer to your needs. Insert the subreport in the group footer of the main {@alph} to the patient name field. Then go into the subreport->report->selection formula and change the formula to:

{table.patientname}[1] = {?Pm-@Alph}

-LB
 
It worked beautifully!!!!!
Thank you for the information!!! It is invaluable!
You are awesome!!!!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top