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.
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]
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