>******************************************************************** >* Description.......: ChangeNameFormat - >* FERNANDEZ P.LUIS ALEJANDRO >* MORALES ESTER >* The idea is take FERNANDEZ P.LUIS ALEJANDRO and change it by Fernandez P., >* Luis Alejandro; or MORALES ESTER and change it by Morales, Ester. >* Calling Samples...: ChangeNameFormat('FERNANDEZ P.LUIS ALEJANDRO') >* Parameter List....: pName >* Created by........: Nadya Nosonovsky 02/24/2000 04:07:09 PM >* Modified by.......: >******************************************************************** >lparameter pName >if empty(pName) && Forgot to provide a parameter > pName='FERNANDEZ P.LUIS ALEJANDRO' >endif >local lcName, lcFirstName, lcLastName, lnPosDot, lnPosSpace >lcName=pName >store '' to lcLastName, lcFirstName > >* You may want to change this for your needs, but you get the idea >lnPosDot=at('.',lcName) && Get the first occurance of . >lnPosSpace=at(' ',lcName) && Get the first occurance of space > >do case > case lnPosDot>0 && . occurs > lcFirstName=proper(alltrim(left(lcName,lnPosDot))) > lcLastName=proper(alltrim(substr(lcName,lnPosDot+1))) > case lnPosSpace>0 && if first case it never checks the second case > lcFirstName=proper(alltrim(left(lcName,lnPosSpace))) > lcLastName=proper(alltrim(substr(lcName,lnPosSpace+1))) > > otherwise > lcLastName=lcName && this person has no first name, how pity! >endcase > >lcName=lcFirstName+iif(empty(lcFirstName),'',', ')+lcLastName >=messagebox(lcName) >return lcName >>>I have a chart with using; a field of the [table] is called name and last name.