Subject Re: Seeing deleted records with CachedUpdates
Author fxam
> Seems to me that you should be determining the balance based on adding up
> the non-deleted records. Are you trying to mix server derived values with
> the cached updates impacted values?
> Jason

I don't know exactly what you mean. So I'll show my example.
I have two tables, the master is ItemTr, the children is ItemTrDet.
There is one field in ItemTr: ID
There are three fields in ItemTrDet: ItemTr_ID, Item_ID and Qty.

A third table called Balance keeps the item balances. It has two fields:
Item_ID and Balance.

1. Let's say initially the balance records are as below:
Item_ID Balance
======= =======
1 100
2 100
2. I insert a record in ItemTr (ID=1)
3. I insert two records in ItemTrDet which point to record in #1:
ItemTr_ID Item_ID Qty
========= ======= ===
1 1 10
1 2 20
4. When I post ItemTr, the program should reduce the corresponding record
in the Balance table. So the Balance table should be updated as below:
Item_ID Balance
======= =======
1 90
2 80
5. At a later time, I delete the first ItemTrDet record, thus the Balance
table should become as below:
Item_ID Balance
======= =======
1 100
2 80

What I do is enabling CachedUpdates for ItemTr and ItemTrDet,
and in AfterPost event of ItemTr, I want to walk through what the user
has done to ItemTrDet, so that I can update the balance. If the user
has deleted something, I must add the qty back to update the balance.

Thanks =)