Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Nested scans
Message
General information
Forum:
Visual FoxPro
Category:
Other
Title:
Miscellaneous
Thread ID:
01379375
Message ID:
01379552
Views:
19
Gary,

You don't mention what version of VFP you are using. You may be able to greatly simplify your code by starting to think in "set" terms.
select ParentKey, sum( x ) as TotalX
   from B
   into cursor Total
   group by ParentKey
So in one command execution you have totaled all of the transactions.

Database normalization rules would tell you though that in general these total values should not be stored in the parent table rows. One reason is the first time a row is added, deleted or updated in the child table you've invalidated the value stored on the parent row.

There are times where you want to keep rolled up information, but they should be specialized fact/reporting tables not your actual transaction tables.

>Sorry if I was vague. I have a parent table , A, which holds summarized values of transaction table, B.
>
>I scan through table A and sum all the records matching A.value. Then I store that sum qty in table A. Go to the next record in table A and then again scan table B matching A.value.
>
>The code runs with out errors, it just seems to skip records.
>When I substitute Do While - EnndDo for the Scan - EndScan, it works as I expect.
df (was a 10 time MVP)

df FoxPro website
FoxPro Wiki site online, editable knowledgebase
Previous
Reply
Map
View

Click here to load this message in the networking platform