Re: Best way to update relationships on fetch
Re: Best way to update relationships on fetch
- Subject: Re: Best way to update relationships on fetch
- From: Arturo PĂ©rez <email@hidden>
- Date: Sat, 11 Oct 2003 21:09:38 -0400
On Saturday, October 11, 2003, at 06:44 PM, Ray Ackland wrote:
Sorry the title couldn't be more descriptive :)
I am working with two tables - people (who have a dob) and age
groupings. The idea is to classify people into different tiers based
on their age, and report on the numbers of people in each group.
My take, which may or may not suit your purposes.
You have two tables: People and AgeGroupings. Define AgeGroupings
like so
DATE GroupBeginDate
DATE GroupEndDate
other necessary columns.
Then create a fetch spec along the lines of
AgeGrouping.GroupBeginDate <= $DOB
AND
AgeGrouping.GroupEndDate >= $DOB.
Then in your People EO you can write a cover method like so
public NSArray relatedAgeGroups() {
NSDictionary bindings = new NSDictionary(this.valueForKey("DOB"),
"DOB");
return
EOUtilities.objectsWithFetchSpecificationAndBindings(this.editingContext
(),
"AgeGroupings",
"relatedAgeGroupingsFetchSpec",
bindings);
}
Well, that's my spin on it. Although one of the lists participants
will tell you that I overindulge
in model fetch specifications. :-)
-------
WebObjects in Philadelphia. You want a cheesesteak with that?
Visit http://webobjects.meetup.com
_______________________________________________
webobjects-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/webobjects-dev
Do not post admin requests to the list. They will be ignored.