Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations sizbut on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Can grow formula - break at certain point?

Status
Not open for further replies.

cocopud

Technical User
Jan 8, 2002
139
US
I have a crystal report that has an email address column which is set to can grow. Sometimes only one letter will go over to the next page. Is there any formula I can use to have it break at the preceding punctuation. For instance firstname.lastname@company.com - If it breaks on the last m, can I force it to break before .com, or if it breaks at the m in company can I force it to break before the @

 
Try something like this:

stringvar x := "firstname.lastname@company.com";
stringvar array y := split(x,"@");
split(y[1],".")[1]; //returns firstname
split(y[1],".")[2]; //returns lastname
split(y[2],".")[1]; //returns company
split(y[2],".")[2]; //returns com

Reference one of the last four lines in each of four formulas.

-LB

 
Oops, lost track of the gist of this. I was thinking you could then write a formula like this:

stringvar x := "firstname.lastname@company.com";
stringvar array y := split(x,"@");
stringvar fname := split(y[1],".")[1]; //returns firstname
stringvar lname := split(y[1],".")[2]; //returns lastname
stringvar co := split(y[2],".")[1]; //returns company
stringvar ext := split(y[2],".")[2]; //returns com

if len(fname+"."+lname+"@"+co+"."+ext) < 20 then/if 20 is max length before wrapping
fname+"."+lname+"@"+co+"."+ext else
if len(fname+"."+lname+"@"+co+".") < 20 then
fname+"."+lname+"@"+co+"."+chr(13)+ext else
if len(fname+"."+lname+"@") < 20 then
fname+"."+lname+"@"+chr(13)+co+"."+ext else
if len(fname+".") < 20 then
fname+"."+chr(13)+"lname+"@"+co+"."+ext

-LB
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top