Skip navigation.
 
mlCore data model, bindings advice.
FROM : Steven Hamilton
DATE : Mon May 12 14:03:03 2008

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?

Related mailsAuthorDate
mlCore data model, bindings advice. Steven Hamilton May 12, 14:03
mlRe: Core data model, bindings advice. Steven Huey May 12, 16:27
mlRe: Core data model, bindings advice. Steven Hamilton May 13, 11:12
mlre: Core data model, bindings advice. Ben Trumbull May 13, 21:46
mlRe: Core data model, bindings advice. Steven Huey May 14, 13:53
mlRe: Core data model, bindings advice. Steven Hamilton May 15, 11:51