Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Select
Message
 
 
To
05/04/2010 15:02:28
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Title:
Re: Select
Environment versions
Visual FoxPro:
VFP 9 SP1
OS:
Windows XP
Network:
Windows XP
Database:
Visual FoxPro
Miscellaneous
Thread ID:
01458778
Message ID:
01458797
Views:
88
This message has been marked as the solution to the initial question of the thread.
Hmm.

Just add

>>
>>local lnRecNo
>>lnRecno = 1
>>select NewTest
>>scan for ID1 = 2
       if between(m.lnRecno, 1, reccount('crsResult'))
>>    goto m.lnRecno in crsResult
>>      replace ty2010 with crsResult.Total
       endif
>>   lnRecno = lnRecno + 1
>>endscan
>>
>thank you,
>
>i get error message Record is out of range at
>
>goto lnRecno in crsResult
>
>>You're right, sorry. The problem is that we don't have another key field to match (as I have to use artificial row column).
>>
>>So, the solution would be
>>
>>local lnRecNo
>>lnRecno = 1
>>select NewTest
>>scan for ID1 = 2
>>   goto m.lnRecno in crsResult
>>   replace ty2010 with crsResult.Total
>>   lnRecno = lnRecno + 1
>>endscan
>>
>>
>>>i mean
>>>crsResult have fields
>>>id total
>>>2 53.670
>>>2 50.330
>>>2 50.246
>>>2 .638
>>>2 110.594
>>>2 2.100
>>>**********************this is correct i need to replace this value to ty2010 at new test as crsResult total
>>>but i see at newtest
>>>id1 ty2010
>>>2 53.670
>>>2 53.670
>>>2 53.670
>>>2 53.670
>>>2 53.670
>>>2 53.670
>>>
>>>
>>>
>>>>>thank you ,
>>>>>i try when i brow the table i see the first vlaue replacement with all id1=2
>>>>>
>>>>>SELECT ID1 ,Y2010, cast(0 as int) as Row FROM NEWTEST WHERE ID1=1 AND ID>0 into cursor crs1 readwrite
>>>>>replace all Row with recno() in crs1
>>>>>
>>>>>SELECT ID1 ,Y2010, cast(0 as int) as Row FROM NEWTEST WHERE ID1=2 AND ID>0 into cursor crs2 readwrite
>>>>>replace all Row with recno() in crs2
>>>>>
>>>>>select c2.ID1, c2.Y2010 + c1.Y2010 as Total from crs2 c2 ;
>>>>>inner join crs1 c1 on c2.Row = c1.Row into cursor crsResult nofilter
>>>>>
>>>>>update NewTest set ty2010 = c1.Total ;
>>>>>from NewTest inner join crsResult c1 on NewTest.ID1 = c1.ID1
>>>>>
>>>>>at crsResult correct
>>>>>
>>>>>brow
>>>>>CLOSE all
>>>>>USE NewTest
>>>>>BROWSE                      && replace the first value for all mean where id1=2
>>>>>
>>>>
>>>>Yes, that's how my code works. It only updates records where ID1 = 2.
If it's not broken, fix it until it is.


My Blog
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform