Jump to content

Carriage Return


This topic is 7874 days old. Please don't post here. Open a new topic instead.

Recommended Posts

I have an one address field that sometimes contains more than one line. instead of wrapping it, there is a carriage return. for instance:

Bailey Building and Loan

1234 Main St.

The problem is, when we send out our newsletter, the company who mails it requires the address info be sent to them in an Excel file. Once i export this information, i loose the carriage return and everything is on one line, and often times that line is too long and some of the information does not show.

Is there a script I can write to find a carriage return in the address field and cut and paste that second line into a newly created field called Address 2?

Link to comment
Share on other sites

  • 2 weeks later...

The way I wrote the If() statement is perhaps a bit confusing. If the first item in the If() statement evaluates to any non-zero value (true), then the second item is returned as the value of the function. If the first item evaluates to zero (false), then the 3rd item is returned as the value of the function. From the Position() function, CR will be 0 (false) if there is no carriage return. Otherwise, it will equal the position of the carriage return (true). So, I could have written the If() statement as either:

If(CR,...

or as:

If(CR>0,...

It is functionally the same thing in this case.

When a carriage return is found, AddressLine1 will contain only the text up to the carriage return, and AddressLine2 will contain the text after the carriage return. If there is no carriage return, then AddressLine1 will contain ALL the text, and AddressLine2 will be empty.

You could also use the Choose() or the Case() function to do the same thing. What I showed is just personal preference. We tend to use what we are familiar with. smile.gif

Link to comment
Share on other sites

This topic is 7874 days old. Please don't post here. Open a new topic instead.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.