Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Matrix rate
Message
 
 
À
25/06/1999 15:39:39
Dovi Gilberd
Dovtware Consulting Inc
Miami, Floride, États-Unis
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Titre:
Divers
Thread ID:
00233938
Message ID:
00234337
Vues:
28
>thank you so much...
>there is alitle problem with the procedure that you sent me
>the name of my oldtabe is Rates
>the fieldnames are code, country,cw_1...and so on (where cw_1 is ratename i)
>
>the name of my newtable is newrates
>the field names are code, country,rateid,rateamount
>
>caoul you please go overit again....thank you
>

The following works regardless of the field names in the old Rates table as long as the CW_1, etc are fields 3 through N where N is equal to the total number of fields in the table. Fields 3 through N are all CW_i fields. Just try it then browse both tables to see what happened. The data in the old Rates table will not be affected.
select Rates
locate
scan
   for i = 3 to fcount()          && 3rd field is Rate1, etc,
       lnRate = eval(field(i))    && returns the actual value in the field
       insert into NewRates ( Code, Country, RateID, RateAmount) ;
          values ( Rates.Code, Rates.Country, i - 2, lnRate )
   endfor
endscan
select NewRates
replace all KeyID with RecNo()   && populate all the KeyID fields
Mark McCasland
Midlothian, TX USA
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform