Hi!
How about using user-defined function in SQL query for string concatenation?
Something like:
PUBLIC lastkey, resstr
lastkey = 0
resstr= ""
FUNCTION sumstr(fKey, fComment)
resstr = IIF(kKey != lstkey, resstr + fComment, "")
lastkey = fKey
END FUNC
SELECT keyfield, sumstr(keyfield, commentfield) FROM ... GROUP BY 1
It's not tested, just an idea.
>I recently created a report for an old application. In the app, the comments are stored as a series of six records with the table structure being a key field and then a 60 character field for the text. So for each comment there will be six records in the table. I wanted to select these into a memo field along with other fields from related tables for inclusion in a report.
>
>I selected the matching records with a sql select by the key field and then used a scan loop to gather the six records into a cursor to combine the six lines into one memo field. This works fine but I am wondering why I couldn't do this with a select statment and not have to rely on the scan loop. For some reason, I am drawing a blank.