Re: CoreData - calculations in tables?
Re: CoreData - calculations in tables?
- Subject: Re: CoreData - calculations in tables?
- From: Scott Anguish <email@hidden>
- Date: Wed, 6 Jul 2005 04:47:45 -0400
just a general note, but one should be very careful when putting
array or set operators in table columns, especially when you have
additional keys on the right side of the operator. You can encounter
_significant_ performance hits if every row in the table has to
iterate over the contents of the collection every time it changes.
it's often better to add a key to your model object to hold those
values.. do the KVO, but keep cache the results
On Jul 6, 2005, at 1:40 AM, Alan Dail wrote:
I am building an app with CoreData and have run into a couple of
issues.
I have a view with two tables, each with their own
NSArrayController. Using bindings, the content set of the 2nd
controller is the selection of the first controller. i.e. the
first table is a list of people, the 2nd list is a list of items
for the selected person. When I select a person, I can add or
delete items for that person. What I wanted to do, though, is add
a column to my table that has the number of items for each person.
The first thing I tried was to simply copy the way the # out of #
display is generated when you create a defeault core data view -
i.e. I mapped a table column to items.@count - this actually
displays the item count for each person, but does not update when
items are added or removed and caused all sorts of problems if i
added items to the main list as a result of notifications.
How should I be doing things like this. In addition to a simple
total, I'd also like to be able to do other calculations on items
in the list. For instance, if they have an attribute that is a
number, I'd like to be able to have the main list give a total
amount from summing all of the items in the sublist.
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden