Let’s say I need to update a property of an entity base on the summary of multiple entities.
Schema:
[{:db/ident :order/total, :db/valueType :db.type/bigdec, ...}
{:db/ident :item/unit-price, :db/valueType :db.type/bigdec, ...}
{:db/ident :item/quantity, :db/valueType :db.type/long, ...}]
Transaction
(d/transact conn {:tx-data [[:db/cas 42 :db/ident :item/quantity 100 110]
'(my.ion/recalculate-total 42)]})
Preferably when tested using a dev-local db, the custom transaction function my.ion/recalculate-total
cannot see the previous datoms (e.g. 110). Is there anyway we can update a value based on previous data in a transaction?