how to set Custom attribute of NSManagedObject which is calculated from other attributes ?

Posted by Kundan on Stack Overflow See other posts from Stack Overflow or by Kundan
Published on 2010-04-30T16:17:35Z Indexed on 2010/04/30 16:17 UTC
Read the original article Hit count: 163

I am using core data framework to manage objects.i have an entity which has several attributes of decimal types. Among them is attribute which is mathematically calculated from other attributes. Ex :-

@interface Marks : NSManagedObject
{
}

@property (nonatomic, retain) NSDecimalNumber * answerGradeA;
@property (nonatomic, retain) NSDecimalNumber * answerGradeB;
@property (nonatomic, retain) NSDecimalNumber * answerGradeC;
@property (nonatomic, retain) NSDecimalNumber * total;

Here i want attribute total = 3xanswerGradeA + 2xanswerGradeB + 1xanswerGradeC

if it is possible to do like this, then how ? please reply. Thanks in advance.

© Stack Overflow or respective owner

Related posts about iphone

Related posts about objective-c