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

How to flatten table?

Status
Not open for further replies.

tcbc

Technical User
Feb 7, 2009
33
US
I have two tables. Here is how data is display.

123 cat domestic
123 cat short hair
123 cat both

I want it to look like this

123 cat domestic short hair both

Does anyone know how I can write a formulat to do this?

Carol
 
You could insert a crosstab in a group footer (with the group based on the ID field), and the ID and animal field as row, and the type as the column field. Then choose maximum of type as the summary field, also. Then suppress the labels, and go to customize style tab->format grid->uncehck "show grid lines."

Or you could create three formulas, one for the ID group header:

//{@reset}:
whileprintingrecords;
stringvar x;
if not inrepeatedgroupheader then
x := "";

//{@accum} to be placed in the detail section:
whileprintingrecords;
stringvar x := x + {table.type}+" ";

//{@display} to be placed in the group footer:
whileprintingrecords;
stringvar x;

Then drag the ID and animal fields into the group footer next to {@display} and suppress the group header and detail section. If you want the types to align across rows, you would have to adapt the {@accum} formula.

-LB
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top