Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Replacement of the records
Message
De
10/07/2004 08:36:35
Fabian Belo
Independent Developer
Argentine
 
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Divers
Thread ID:
00922947
Message ID:
00922954
Vues:
21
>I have some fileds in my table like this.
>
>name examcode month
>1 jan 03
>23 fab 02
>44 nov 03
>My problem is this i want to replace month fileds with this
>if jan 03 in the examcode replace the month with 1
> or
>if nov 03 in the examcode replace the month with 11
>I have more than 2000 records in examcode. How it can be possebel.
>thanks

First of all you have to change the field name "month" to another (ie. nMonth) since "month" is a reserved word.
My take:

Call a .prg passing a parameter
SELECT test1
scan
c3 = ALLTRIM(LEFT(examcode ,3))
DO rep1 WITH c3
replace nmonth WITH cRes
ENDSCAN
Where rep1.prg would be:


PARAMETERS cMes
PUBLIC cRes
DO case
CASE cMes = "jan"
cRes = 1
CASE cMes = "feb"
cRes = 2
CASE cMes = "nmr"
cRes = 3
CASE cMes = "apr"
cRes = 4
CASE cMes = "may"
cRes = 5
CASE cMes = "jun"
cRes = 6
CASE cMes = "jul"
cRes = 7
CASE cMes = "aug"
cRes = 8
CASE cMes = "sep"
cRes = 9
CASE cMes = "oct"
cRes = 10
CASE cMes = "nov"
cRes = 11
CASE cMes = "dec"
cRes = 12
ENDCASE
RETURN cRes
<\pre>
"Since I've read that alcohol is bad... I quit reading."
Me


http://www.fabianbelo.com.ar
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform