Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Opening Balance
Message
From
17/06/2008 17:46:18
Dragan Nedeljkovich (Online)
Now officially retired
Zrenjanin, Serbia
 
 
To
16/06/2008 23:46:28
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Title:
Miscellaneous
Thread ID:
01324211
Message ID:
01324942
Views:
11
>>>Dear Bhavbhuti Nathwani
>>>
>>>No body wrote any code in this thread. Every body try to present suggestions.
>>>I ask if thread poster knows the codes then what he needs to post any thread.
>>
>>It's easy to write the code - it's much harder to design the tables (or even temporary cursors) to have as little code as really necessary.
>>
>>There are several things to consider in your case (and yes, I had my running totals to do in my time). First, can you trust the totals column? Is it possible that a record may come somewhere in the middle and you'd have to recalculate everything from that point on? Is it possible that a record may be deleted (and then recalculate everything again)? Also, are you sure the records will always show in this order? If there's any chance that they may show in a different order, then you'd have to recalculate for the new order.
>>
>>If it will always be by date, and there is one and only one record per date, then it's simple:
>>
>>
>>lnTotal=0
>>lnOpening=0
>>scan
>>   lnTotal=lnTotal+receipt-payment
>>   replace opening with lnOpening;
>>      ,   total with lnTotal
>>   lnOpening=lnTotal
>>endscan
>>
>>If any record changes (add new, change existing, delete... anything), you would need to run this again.
>__
>
>Dragan,
>
>Seems to me the 'opening' is in every record already. How else does he know the balance?

See how many ifs have I put before my code? There's so many things which may influence the outcome and, in the end, make any solution perfect or perfectly ridiculous... things which we don't know, like "is this a cursor created on the fly or is this a real transactional table", "is this updated sometimes?" etc etc.

back to same old

the first online autobiography, unfinished by design
What, me reckless? I'm full of recks!
Balkans, eh? Count them.
Previous
Reply
Map
View

Click here to load this message in the networking platform