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

List Multiple Records from Subreport On One Line

Status
Not open for further replies.

peterenman

IS-IT--Management
Feb 1, 2010
7
CA
I have a basic subreport with one field in the details section of the report that brings back a list of individuals connected to the table in my main report.

Ex:
John Doe
Jane Doe

The number of people varies for each new instance in my main report. (There could be 2, 3, 9 etc. people listed)
I want the names to list hoizontally as follows:
John Doe, Jane Doe

I'm not really sure where to start. If someone could help me out with this one I would greatly appreciate it.

 
Create three formulas:

@Names
whileprintingrecords;
stringvar vNames := vNames + {table.field} + ' ,'

Place it in the detail and suppress;

@DispNames
whileprintingrecords;
strinvar vNames;
left(vNames, length(vNames) - 2))

Place it in the subreport footer

@ResetvNames
whileprintingrecords;
stringvar vNames := ''

Insert a second subreport footer section, to place it in, and suppress.

Dana



 
Hey Dana,
First of all thanks for your help. I was actually using these formula already from one of your previous posts, but this only lists them in the same way as if I just had the field in the details section of the subreport:
John Doe
Jane Doe
Jack Doe

I need them to be listed side by side, separated with a comma and a space:
John Doe, Jane Doe, Jack Doe

If you could get this to happen I would greatly appreciate it.

Peter
 
You should check the formulas and their placement, as you must have implemented ian's suggestion incorrectly.

-LB
 
Here is my subreport structure:

Subreport: Grouped by {X_PERSON.KNOWN_AS}
Details Section: (suppressed)
@Names
whileprintingrecords;
stringvar PersonList := PersonList + {X_PERSON.KNOWN_AS} + ', '

GF#1a:
@Display
whileprintingrecords;
stringvar PersonList;
left(PersonList, len(PersonList)-2)

GF#1b: (suppressed)
@Reset
whileprintingrecords;
stringvar PersonList := ''

Is this correct?
 
I assume you are grouping on the name field because it appears multiple times in the detail section? Place the first formula in the group header or footer for the name field, and place the display formula in the sub report footer. Place the reset in the subreport report header.

-LB
 
When I reorganized the placement of the formulas I was getting the result I wanted, but I was also getting repeated data on several rows. So I thought about what you said in regard to the grouping and I changed it to reflect the grouping in the main report and it worked like a charm. Thanks you guys.

Peter
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top