Skip to Content
0
Former Member
Dec 04, 2008 at 02:16 PM

Concatinating a field from several records into a single string

29 Views

Using Crystal Reports 11

I have a table of EMS/Fire runs, with a related table of fire trucks that respond on each run. My report is grouped by EMS/Fire run, and then the details section shows each truck, something like this....

Run #1 |  123 E Main St  |  Structure Fire
     E123
     E124
     E125
     L123
     L342
     R153

Run #2  |  455 S High St  |  Fire Alarm
     E322
     E233
     L122

What I would like to do is hide the details section, and instead in the footer section of each group, have a "text field" that combines all of the trucks into 1 line, something like this...

Run #1 | 123... | Stru... |  E123, E124, E125, L123...
Run #2 | 455... | Fir... |  E322, E233, L122

Basically the logic would be:

   For Each RecordInThisGroup
        If Maximum(TruckNumberField) = TruckNumber Field Then
             TruckNumberField
        Else
             TruckNumberField & ", "
   Next RecordInThisGroup

Is there a way to loop through all the records in the group?

Thanks for any insight!

Jason