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 TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Splitting address field

Status
Not open for further replies.

Rob32

Technical User
Oct 14, 2002
18
NZ
Hi

I am using Crytal Reports 7, reporting out of a SQL database. One of the fields is a postal address field, that uses chr(13) to encode a new line in the field. So, for example, the field looks something like this ( chr(13) is, naturally, not visible):

31 Smith Street chr(13)
Smithville chr(13)
Smithtown

The issue for me is that sometimes I want to be able to split the address so that each line is reported as a new field.

Can anyone help me with this one - much appreciated.

Cheers, Rob.
 
To return the first element, create the following formula:
-----------------------------
Split({address}, Chr(13))[1]
-----------------------------

To return the second element, create the following formula:
-----------------------------
Split({address}, Chr(13))[2]
-----------------------------

and so on...

Cheers,
- Ido CUT, Visual CUT, and DataLink Viewer:
view, e-mail, export, burst, distribute, and schedule Crystal Reports.
 
Ido

Thanks for your timely reply. I tried your suggestion, but it gave me the error message "The remaining text does not appear to be part of the formula" with the cursor placed at the beginning of the formula. Is the "split" function available for CR7?

Cheers, Rob.
 
I guess it doesn't... :)

OK, to get the first elemnt:
-----------------------------------------
LEFT({address}, InStr({address}, Chr(13)))
-----------------------------------------

Continue with similar logic using a combination of LEFT(), RIGHT(), InStr(), and MID() functions.

Cheers,
- Ido CUT, Visual CUT, and DataLink Viewer:
view, e-mail, export, burst, distribute, and schedule Crystal Reports.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top