How To retrieve the Relationsships from an entity in Core Data
How To retrieve the Relationsships from an entity in Core Data
- Subject: How To retrieve the Relationsships from an entity in Core Data
- From: Janakiram <email@hidden>
- Date: Fri, 16 Dec 2005 13:11:46 +0530
Hi,
I am a new bie to core data. I have two entities names employee &
department. I have a relation, in employee , named departments which
specifies the departments in which the employee works. I can create
employees & departments.But i am unable to retrieve the employees who
r having salaries greater than $10,000 present in a given department.
I don't have a relationsship from department to employee. I think , i
am probably missing the predicate for the fetch request. Below is the
Code for the fetch request.
NSEntityDescription *entity = [NSEntityDescription
entityForName:@"Employee" inManagedObjectContext:managedObjectContext];
NSFetchRequest *aRequest = [[NSFetchRequest alloc] init];
[aRequest setEntity:entity];
[aRequest setPredicate:[NSPredicate predicateWithFormat:@"salary >=
%f and departments.DeptID == %@ ",10000.0,2]]; // where dept id is 2.
NSError *error = nil;
NSArray *headerFooterSettingsResult = [context
executeFetchRequest:aRequest error:&error];
Please help me to solve this. Thanks in Advance.
-JanakiRam.
_______________________________________________
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