Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Matrix rate
Message
 
 
To
26/06/1999 12:03:42
Dovi Gilberd
Dovtware Consulting Inc
Miami, Florida, United States
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Title:
Miscellaneous
Thread ID:
00233938
Message ID:
00234500
Views:
32
That is what the field(i) is for. The function FIELD() returns the actual field name. Using this with the EVAL() function returns the actual value stored in the field, Eval(Field(i)). Yes, the procedure is creating the records for you in the new NewRates table. Have you even tried it yet. I promise it will work if you have provided the correct table structure. The basis is that fields 3 through the last field are your various rate fields. If you have 20 rate fields and they are fields 3 through 22, then you can substitute for i = 3 to 22.

My preference is you please try this and not e-mail me the tables. I barely have sufficient time for monitoring this forum as a SysOp, reply to these messages, process e-mail and my normal job.

>thank you mark...question...the field 3 to fieldn they all have diferent nams...does it matter if field3 is cw_51x and field 4 is another rate named CALMAR?
>and exactly what is this procedure doin?...is it copying records to the new database...
>is there a way of using the same structure i have ad telling the program
>that if it has selected rate1 to select field 3, if it has rate 4 to select rate 4 and so on...
>
>
>>>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
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform