Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Trigger -> Wrong Results
Message
From
15/02/2004 16:54:12
Hilmar Zonneveld
Independent Consultant
Cochabamba, Bolivia
 
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Miscellaneous
Thread ID:
00877268
Message ID:
00877517
Views:
13
>Hi Hilmar,
>
>Thank you. I've thought about this solution, but I was looking for something that just working with that code (with some adjusts, of course)...

The problem you had is that uncomitted changes in the current record were not recognized, right? The other alternative is to save values of relevant fields for the current record, and the current recno(), to variables. Then, when using SUM(), replace the saved value if you come to the corresponding record. This will only work for tables. For views (and tables, too), you can use the PK instead of the recno(). This should work best if the end-user can't edit the PK.

>
>I have one little question: Do you have it working in production, don't you? ... So, if yes, have you had some problems with wrong calculates? I'm afraid about keep wrong information on Table_A. If it happens, I'm really in trouble!

I have used both alternatives in production.

The incremental variety is actually safer in some cases: if the end-user wishes to adjust, for instance, the total stock, he can change it in the parent table. Then, changes in the child table will not reset this total.

If you always want to have the same result as you get with a SUM(), you should have a procedure that recalculates manually (if you use the incremental version).

HTH,

Hilmar.
Difference in opinions hath cost many millions of lives: for instance, whether flesh be bread, or bread be flesh; whether whistling be a vice or a virtue; whether it be better to kiss a post, or throw it into the fire... (from Gulliver's Travels)
Previous
Reply
Map
View

Click here to load this message in the networking platform