Re: Core Data, multiply values when inserted and show immedialty
Re: Core Data, multiply values when inserted and show immedialty
- Subject: Re: Core Data, multiply values when inserted and show immedialty
- From: Gustavo Pizano <email@hidden>
- Date: Thu, 5 Nov 2009 23:15:53 +0100
Volker Hello
.
Yes Im sorry I was in a rush going out form the office,
I in fact fixed already, I did in my NSManagedObject subclass
-(NSDecimalNumber *)totalItemPrice{
NSDecimalNumber * number;
double a = [[self quantity] doubleValue] * [[self unitPrice]
doubleValue];
number = [[[NSDecimalNumber alloc] initWithDouble:a] autorelease];
[self setTotalItemPrice:number];
return number;
}
I overrode only the getter, so I guess when the tablecells via
bindings ask for that value, I return the product of the other 2
values, and set the resutl also, I dunno if this is the correct way to
do so, but it worked :D:D:D.
thanks for the reply .
Gustavo
On Nov 5, 2009, at 7:30 PM, Volker in Lists wrote:
Hello,
if you do set values in your NSManagedObject subclass (or anywhere
else) you maybe not telling KVO that something has changed?
willChangeValueForKey / didChange....
but without any code and further information, no chance to help.
Volker
Am 05.11.2009 um 13:58 schrieb Gustavo Pizano:
Hello.
I have set up my NSArrayController, and the NSTable with their
columns and formatters (for the number values), now, when I click
the add button, I can input values in the table cells, one of the
cells is a "totalValue" which is the product of quantity *
unitPrice, I had that column non-editable, because I was thinking
that once I place the values of quantity and unitprice that cell
should show the totalValue.
I overrode the setter of totalValue in the custom NSManagedObject,
and I have done the product of the values there, but im missing
something because its not working... its not updating the value
once I have put both the unitPrice and the totalValue.
Has somebody done something like this? I guess yes.. :P,
any help will be appreciate it.
Thanks\
gustavo_______________________________________________
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
_______________________________________________
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