Core data model, bindings advice.
Core data model, bindings advice.
- Subject: Core data model, bindings advice.
- From: Steven Hamilton <email@hidden>
- Date: Mon, 12 May 2008 22:03:03 +1000
Hi folks,
Continuing my learning into Cocoa I'm developing a personal finance
application. An admirable project I believe since none available suit
my purposes and it always pays to have a project that one would use to
learn from.
I have a simple core data model consisting of AccountGroup, Account,
Transaction and I've jammied these all into a window with outline
view, transaction tableview and detail at the bottom. The model looks
like this;
AccountGroup (Asset, expense, income etc)name (string)
accounts (relationship to Account)Account (Bank, Savings etc)name
(string)
transactions (fetched properties explained below)
credit (relationship to transaction)
debit (relationship to transaction)Transaction
memo (string)
date (date)
amount (NSNumber)
fromAccount (reverse of debit)
toAccount (reverse of credit)
I believe this to be the true model as a transaction is an object and
is of an amount that goes from somewhere to somewhere. This is double
entry accounting. My problem is in presenting this to the user.
Problem 1
Most finance apps, and mine included you select an account from a list
(my outlineview) and it then displays all the transactions involved.
So I created a fetched property with a predicate that included any
transactions that had the selected account name in either fromAccount
or toAccount. This works to a point. My tableview displays all the
transactions of the selected account but since its a fetched
properties (contentArray) the list isn't the true transaction array
(contentSet), therefore I cannot add to it using the bound detail
table below it.
I must admit the bindings for this are really playing with my head. I
struggled quite immensely getting the selection from the
treecontroller and in the end it started working without me fully
understanding why. I have further complications to come as I have the
decide whether the transaction amount is a debit or credit (based on
the from/to account relationships) and then display the amount in the
correct column and then also work out a way to add transactions back
in like this.
It seems even though I'm set on what I believe to be the correct data
model for this, the method of which a user expects to see this
information is a little too different. Does anyone have any advice?
Have I talked too much?
_______________________________________________
Cocoa-dev mailing list (email@hidden)
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:
This email sent to email@hidden