Re: Trying to Tweak a WORepetition
Re: Trying to Tweak a WORepetition
- Subject: Re: Trying to Tweak a WORepetition
- From: David LeBer <email@hidden>
- Date: Wed, 13 Oct 2004 19:47:46 -0400
On Oct 13, 2004, at 4:59 PM, Janice Cheung wrote:
Greetings!
I have a question concerning WORepetitions:
1. Is there a way for one WORepetition to speak to another? For
example, I have two
separate WORepetition lists. One list contains all the
departments a user belongs to.
The second list contains all the departments an administrator
is responsible for. I would
like to combine both WORepetitions together as one list,
removing any repetitive data (such
as where a department administrator belongs to a department,
yet is the administrator for
that very same department).
The WORepetition is really just a display device and as such doesn't
have a lot of smarts. What it sound like you want to do is either
combine two existing NSArrays or create a new fetch that fetches all of
the Departments that fit your criteria into one NSArray, and use that.
1. Combine two existing NSArrays - I'd use ERXArrayUtilities from
Project WONDER:
NSMutableArray combined = deptArray.mutableClone();
ERXArrayUtilities.addObjectsFromArrayWithoutDuplicates(combined,
adminDeptArray);
This will leave you with the "combined" array containing all of the
objects with no duplicates.
It wouldn't be hard to recreate the functionality of the
ERXArrayUtilities method, but I'm adverse to writing code if someone
else has already :-)
2. Create a fetch that fetches all of the Departments that fit your
criteria.
I'd probably create a fetchSpec in my model for this (mostly because I
use eogenerator, and its cool template that generates named methods for
my fetchSpecs in my EO's saving me a ton of code). I'll leave that up
to you, it will have to depend on the keys/relationships in your model.
;david
--
David LeBer
Codebase Software Systems
site: http://www.codebase.ca
blog: http://david.codebase.ca
Attachment:
smime.p7s
Description: S/MIME cryptographic signature
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden