Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
To use calculated field or not?
Message
De
14/01/2012 15:40:48
Dragan Nedeljkovich (En ligne)
Now officially retired
Zrenjanin, Serbia
 
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Versions des environnements
Visual FoxPro:
VFP 9 SP1
Divers
Thread ID:
01532936
Message ID:
01532948
Vues:
56
>I agree with you about being incorrect. I have one other case where I use a calculated field in the parent table and it is never clear if the value is accurate. I also lean toward calculating on-the-fly. The only downside is that the program has to make a "trip" to calculate but given that databases are fast and computers are fast hopefully it won't be a huge issue.

The speed wasn't an issue, the accuracy was. I've had the opposite case, some 22 years ago, when I stayed one long afternoon to clean it up - because I didn't keep the subtotals (of invoice, its rebate, taxes etc) in the parent record, but recalculated them. And then the sum total of invoices never matched the sales, because the subtotals were grouped differently (once by invoice, once by SKU) and then the percentages were applied at subtotal levels. The roundoff error was different, and you can't say that to an accountant. They don't care to how many decimals is it correct, it has to match.

So the rule of (my sore) thumb is to calculate anything that may be used further down the road, and keep that calculated and rounded (!) value in the child record. Then, on any report you only do totals, they match, and you go home on time.

back to same old

the first online autobiography, unfinished by design
What, me reckless? I'm full of recks!
Balkans, eh? Count them.
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform