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 := '';
xmcierAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

ravenblueCommented:
what version of crystal?
0
ravenblueCommented:
version 8 and before have 256 character limit for string variables
0
jruheCommented:
This is a little rought, but depending on if you can anticpate its length (and be sure it's less than, say, 1020 characters. . .

Shared stringVar sText1, sText2, sText3, sText4;
if length(sText1) + {table.ST1} >255 then
   if length(sText2) + {table.ST1} >255 then
      if length(sText3) + {table.ST1} >255 then
         if length(sText4) + {table.ST1} >255 then
            sText4="String too long to fit."
         else
            sText4=sText4 +' ' + {table.ST1}
      else
        sText3=sText3 +' ' + {table.ST1}
   else
       sText2=sText2 +' ' + {table.ST1}
else
   sText1=sText1 +' ' + {table.ST1}

Then make a separate section for sText1, sText2, etc.  Force each section to supress if sText1, 2 whatever, is = ' '

There might be a more savvy do-loop that you can do, but I don't know how to macro-substitute a name of a variable, so this may be clunky but it'll work.  Warning:  This is off the top of my head (I didn't test it).  But some slight variation of this should work.

JR
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
xmcierAuthor Commented:
This question is for v8.5.

I believe JR's solution is going to take care of the issue.
THANKS!
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Crystal Reports

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.