Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here


In concatenation, how to decide where line break happens

In concatenation, how to decide where line break happens

In concatenation, how to decide where line break happens

Hi all...

I have a list of names...
Brian P. Bennett
Mario Puzo
Hugh E. Hefner
Lucy Arnez

I have used the following code to concatenate them...

Shared StringVar ConCat;
If ConCat = "" then ConCat := {table.field}
else if not({table.field} in ConCat) then ConCat := ConCat + ", " + {table.field}

...and I have the 'Can Grow' checked on the display field so now I get:

Brian P. Bennett, Mario Puzo, Hugh
E. Hefner, Lucy Arnez

Is there a way I can make the report keep Hugh E. Hefner together?

I'm using CRXI, if that matters...

RE: In concatenation, how to decide where line break happens

This seems to work. I arbitrarily used 30 as the cutoff for the length of the concatenation per line, but you could use whatever length you like (change in both places)--except that the formula object must be stretched beyond that length or it will automatically wrap. Replace {@Name} with your name field.

Shared StringVar ConCat;
numbervar cnt;
numbervar i;

for i := 1 to len(Concat) do (
if remainder(len(concat),30)=0 then
cnt := 1 else
cnt := cnt + 1
if not({@Name} in ConCat) then
if onfirstrecord then
concat := concat + {@Name} else
if not onlastrecord and
len(previous({@Name})) + len({@Name}) < 30 then
ConCat := ConCat + ", "+{@Name} else
concat := concat + ", " +chr(13)+{@Name}


Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close