Hi all,

I'm (slowly) learning mapbasic and I'm trying to update the value of  _col2 based on the number in _col3 * _col1. To this end I have tried 2 different ways of achieving this.
1. Select all the records in Tablename that fall within certain parameters and then update Tablename from that selection. (the batch approach)
i.e.
 
Select * From Tablename Where _col1< 15
Fetch First From Selection
Do While Not EOT(Selection)
Update Selection Set _col1 = _col2
Loop
 
This doesn't work
 
2. so I tried to loop through all the records in the table updating _col2 based on the value in Tablename._col1
ie
 
Fetch First from Tablename
 Do While Not EOT(Tablename)
     If (Tablename._col1<=15) Then
         Update Tablename Set _col2=_col3
         ElseIf Tablename._col1>15 and Tablename._col1<=16 Then
         Update Tablename Set _col2=(_col3-((_col3/100)*1.2))
         ElseIf Tablename._col1>16 Then
         Update Tablename Set _col2=(_col3-((_col3_col2/100)*17))
         End If
    Fetch Next From Tablename
Loop
 
This doesn't work either!
I know this must be a very simple thing to try and do - so could anyone please point me in the right direction?
 
                                Thanks,
 
                                                Jim Wilson
 

Reply via email to