Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Changing the field values
Message
 
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00336991
Message ID:
00337108
Vues:
16
Hi Andrews,

>May be this little program, which I just created, can help you:

So, you can call this program:
REPLACE last_first_name with ChangeNameFormat(alltrim(last_first_name) all
(Don't forget to comment messagebox)
HTH

>
>********************************************************************
>*  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.
>>This field contains all the names and last name of the employees of the following way:
>>FERNANDEZ P.LUIS ALEJANDRO
>>MORAL ESTER
>>The idea is take FERNANDEZ P.LUIS ALEJANDRO and change it by Fernandez P., Luis Alejandro.
>>How could I make this with a program, considering that does the chart have 3 thousand registrations.?
>>TIA
If it's not broken, fix it until it is.


My Blog
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform