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!

Parsing a memo field

Status
Not open for further replies.

OldtTimerDon

Programmer
Oct 6, 2012
34
US
I have a memofield that contains the full names of people which are separated by commas. The number of names in a record can be as few as three or as many as nine. The names were input as firstname, middle name(or initial) lastname. Commas are used only to separate fullnames.I would like to create a table of these names. How can I parse the names so that each full name is a separate record? Once they are separate records, I believe I can readily parse the lastname to a separate field with the residue in a firstname+init field.
Thank you all for stirring the decaying braincells of this senile senior.
Don
Sun City, AZ
 
Code:
* This will give you an array of names:
lnNumberOfNames = Alines(laNames,Memofield,",")

* and this will put it into a cursor or table of it's own:
Dimension laNames(lnNumberOfNames,1)
Create Cursor curNames (cFullname C(254))
Append From Array laNames
The dimensioning is needed, as the array created by ALINES is one dimensional and not usable by APPEND, but specifying there is 1 column makes it a two dimensional array, though no new elements are added.
When you're there you can use GETWORDNUM to get the single names of the full names. You might also dimension the array with 2 columns and preprocess it before appending to a cursor with lastname, firstname fields.

Bye, Olaf.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top