On Jun 18, 2008, at 13:04, Ben Trumbull wrote:

*Amount* is an calculated field and it depends on the previous transactions. I don't know how to do it! It is not a value I can save on database, for
example, because it changes all the time (I guess I have to mark the
transient field at Core Data).

As someone else mentioned, you probably want to move "amount" over to Account as "balance". You can make it transient.

Given that the OP seemed to want to display cumulative balances with each displayed transaction (like a Quicken register does), a single account balance property doesn't really help.

And the right approach (whatever it is) is a little bit subtle, I think. If there are multiple transactions with the same sort key (the same date, in the OP's example), or the transactions might be listed in various orders, you'd have to accumulate the balance based on the actual displayed order, so it's unlikely that it could be kept in the data model (e.g. as a Core Data property) unless you added transient sets of report items separately from the set of transactions. In a way, the balance is a transient property of the "V" rather than the "M".

This is a bit OT, I guess, but it's interesting to notice that Cocoa doesn't seem to have any standard coding patterns that would deal with this simple-seeming case.


_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]

Reply via email to