CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2
  1. #1
    Join Date
    Aug 2003
    Location
    CA
    Posts
    2

    Question Concatenate in Crystal Report

    Hello,

    How can I concatenate data in a field? Example, I got an output of data that print out on the report as one data per row:
    20
    25
    41
    56
    and I want it to look like
    20, 25, 41, 56

    The number of data in the field various.

    Thanks.

  2. #2
    Join Date
    Jul 2003
    Location
    Florida
    Posts
    651
    Use a loop to go through the number of fields you have. The first time the loop runs, the temporary string will have nothing in it. Every time after, it will concatenante a comma and space, then concatenate the next field. Once the all the fields have been looped through, you will have one string with the values separated by a comma.


    Code:
    dim intCounter as Integer
    dim strTempString as String
    
    For intCounter = 1 to <number of Fields>
    
    	If strTempString = "" then
    		strTempString = Field(intCounter)
    	Else
    		strTempString = strTempString & ", " & Field(intCounter)
    	End If
    Next intCounter

    Fiona
    Last edited by malleyo; August 14th, 2003 at 04:00 PM.
    I'd rather be wakeboarding...

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured