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

Using Split to break up an address field with multiple lines?

Status
Not open for further replies.

MFKJB

IS-IT--Management
Jan 7, 2005
3
0
0
GB
Hi,

I have a field I wish to break up into individual formula fields so each address line is stored seperately.

I'm attempting to use the split function to break up the field as follows :
Split({MainOrder.DeliveryAddress},Chr(013))[1]

This gives me the first line of the address field, however I can't retrieve any of the remaining 3 other lines using the syntax :
Split({MainOrder.DeliveryAddress},Chr(013))[2]

Any ideas where I'm going wrong?
 
What does chr(13) stand for? A line break or a space? Can you post some example data and desired output?

Software Sales, Training, Implementation and Support for Exact Macola, eSynergy, and Crystal Reports
askdon@srhconsulting.com
 
Chr(13) is a carriage return.

Basically our field has 4 lines, each seperated by a carriage return, so using chr(13) I can detect each end of line and therefore distinguish between address lines.

 
Is it possible that you have multiple returns after each line? Or a line feed code as well? What happens if you try:

Split({MainOrder.DeliveryAddress},Chr(013))[3]

-LB



 
No, there is a single CR. If you export the data into excel you can see a small box which indicates the single CR.

Trying your suggestion gives the following error :

A Subscript must be between 1 and the size of the array.
 
following sample code on using split will help u to fix the problem.

stringVar array abc;
stringvar var:='hello'+chr(13)+'hi'+chr(13)+'how are you';
stringvar result;
numbervar i;
abc:=Split(var,chr(13));
for i :=1 to ubound(abc) step 1 do
result:=result+abc+',';
result;
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top