Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
End of file encountered
Message
From
08/07/2005 15:46:18
 
 
To
08/07/2005 15:24:14
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Environment versions
Visual FoxPro:
VFP 8
Database:
Visual FoxPro
Miscellaneous
Thread ID:
01030354
Message ID:
01030705
Views:
14
That's because you have the inner m.divi = curbilldata.divi AND NOT EOF() loop, which moves to the last record without doing anything.
Use curbilldata
Use curbilldata again as dummy
Scan
  m.divi = curbilldata.divi
  Select dummy
  SUM val(tot_t) to  m.r for dummy.divi=m.divi 
  m.qa=(VAL(curbilldata.tot_t))/(VAL(curbilldata.tot_tot))
  ? m.qa 
  select curbilldata
  replace tot_tot WITH str(m.r/2,10,2) && 10,2 means 10 digits in total including two decimals and decimal point , max 9999999.99
Endscan
Use in dummy
Brow
But why in he** do you use character fields for numeric values??? Use numeric, currency or integer ALWAYS, always, ALWAYS for numeric values!!!!!!!!


>hi,
>i try many tims,
>if i remove ,for m.divi = curbilldata.divi
>i get result for every divi as
>
>divi tot_tot
>----- -------
>a
>a
>a
>a 12345
>b
>b
>b 3214
>.
>.
>
>--------------
>but i need it as
>divi tot_tot
>----- -------
>a 12345
>a 12345
>a 12345
>a 12345
>b 3214
>b 3214
>b 3214
>c
>c
>.
>.
>
>thanks.
>
>>Sorry, I did not notice that you used VFP8, the update syntax I showed you was introduced in VFP9. For VFP8 you should use a Scan-Endscan loop.
>>
>>But I really don't understand why you have the inner m.divi = curbilldata.divi AND NOT EOF() loop, is it to find the last record in a group?
>>
>>>hello ,
>>>i try i get error messag
>>>function name is missing
>>>thanks.
>>>>You should learn SQL, you will save a looot of time! Something like this will replace your whole little program:
>>>>Update curbilldata set tot_tot=(Select sum(master.tot_t/2) from curbilldata master where master.divi=curbilldata.divi)
>>>>
>>>>NB! Note that this line may not do the work without modifications, but is should be a very good start!
>>>>
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform