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

Parsing text into a grid 1

Status
Not open for further replies.

VE

Technical User
Oct 25, 2000
220
US
Hi,

I'm using CR 2008

I'm trying to take a single comment field that looks something like this:

Name: John Smith
Phone number:555-555-5555
Address: 123 cherry lane
Seattle, WA 98000

And make it into 3 fields that would look like this

Name Phone Number Address
John Smith 555-555-5555 123 cherry lane
Seattle, WA 98000

The columns do not have the same number of charactors between them in the text field.

I'm getting the first and the last OK, it's the ones in between that have me stumped.

Thank you in advance

VE
 
You can use "Phone number:" and "Address;" with the SPLIT command to separate the three components, using nested commands or formula field. (Use HELP if you need to know the SPLIT format. Also REPLACE to get rid of the "Name:" etc. from the separated items.

I suggest you do this by stages and display the results, before proceeding futher. And hard-code the column headers.

For the two or more lines of address, you should be able to use SPLIT again, perhaps using two spaces as the separator. You'd then need a bit of long-winded logic to get rid of unwanted spaces. Use UBOUND to find out how many parts the text has been split into.

[yinyang] Madawc Williams (East Anglia, UK). Using Crystal 11.5 with SQL and Windows XP [yinyang]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top