|
-
January 4th, 2017, 02:40 PM
#1
Combine multiple rows into a single row concatenating fields
Sample# analysis Method
211 BOD 4500
211 TKN 2500
211 VSS 1200
212 Metals 208
212 TSS 123
I would like to see on my report
211 BOD,TKN,VSS 4500,2500,1200
212 Metals,TSS 208,123
I found online code to create the following:
211 BOD,TKN,VSS
but I don't know how to do the additional field.
I will not pretend I understand what I have done, but it does work for me.
Here is what I did to get the first field to summarize
Formula 1
whileprintingrecords;
stringvar names := "";
Formula 2
Whileprintingrecords;
stringvar names;
names := names & ", " & {Command.Analysis};
Formula 3
whileprintingrecords;
stringvar names;
Mid(names, 3);
Formula 4
(not onlastrecord
and
{Command.SampleId}=next({Command.SampleId}))
Thanks in advance for your expertise.
-
January 4th, 2017, 02:43 PM
#2
Re: Combine multiple rows into a single row concatenating fields
I want three separate columns
Sample# (Column 1) Analysis (Column 2) Method (Column 3)
In the body of the question, It looks like I want only two columns which is not the case.
Sample# analysis Method
211 BOD 4500
211 TKN 2500
211 VSS 1200
212 Metals 208
212 TSS 123
I would like to see on my report
211 BOD,TKN,VSS 4500,2500,1200
212 Metals,TSS 208,123
I found online code to create the following:
211 BOD,TKN,VSS
but I don't know how to do the additional field.
I will not pretend I understand what I have done, but it does work for me.
Here is what I did to get the first field to summarize
Formula 1
whileprintingrecords;
stringvar names := "";
Formula 2
Whileprintingrecords;
stringvar names;
names := names & ", " & {Command.Analysis};
Formula 3
whileprintingrecords;
stringvar names;
Mid(names, 3);
Formula 4
(not onlastrecord
and
{Command.SampleId}=next({Command.SampleId}))
Thanks in advance for your expertise.[/QUOTE]
-
January 27th, 2017, 01:14 PM
#3
Re: Combine multiple rows into a single row concatenating fields
Just add another variable and do the same for Method as you do for Analysis
Code:
Formula 1
whileprintingrecords;
stringvar names := "";
stringvar names1 := "";
Formula 2
Whileprintingrecords;
stringvar names;
stringvar names1;
names := names & ", " & {Command.Analysis};
names1 := names1 & ", " & {Command.Method};
Formula 3
whileprintingrecords;
stringvar names;
stringvar names1;
Mid(names, 3); & " " & names1
JG
... If your problem is fixed don't forget to mark your threads as resolved using the Thread Tools menu ...
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|