Link to home
Start Free TrialLog in
Avatar of xmcier
xmcier

asked on

How do I concatenate multiple fields

I have a situation pretty much identical to the one for post Q_21354613.html:
 I have a database table with the fields

STN0       LN                  Text
ST1           1                    Line 1 Text
ST1           2                    Line 2 Text
ST1           3                    Line 3 Text
ST1           4                    Line 4 Text

I want to concatenate the fields so I get the output :
STN0       Text.......
ST1         Line 1 Text Line 2 Text Line 3 Text Line 4 Text

The solution (Below) provided by Frodoman returns the message "A string can be at most 256 characters long."

Is there a way to get a longer result?

The previous solution from Frodoman:
I assume that you're grouping the report based on STN0 (If not then you probably will need to do so).  You can then use ST1 in your details section and create a formula in your details section like this:

shared stringVar sText;
sText := sText + ' ' + {table.ST1};

Now in the group footer create a formula to display the concatenated text:

shared stringVar sText;

And in the group header create a formula to reset it:

shared stringVar sText := '';
Avatar of ravenblue
ravenblue

what version of crystal?
version 8 and before have 256 character limit for string variables
ASKER CERTIFIED SOLUTION
Avatar of jruhe
jruhe
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of xmcier

ASKER

This question is for v8.5.

I believe JR's solution is going to take care of the issue.
THANKS!