Re: Comparing 2 Arrays if they have same objects
Re: Comparing 2 Arrays if they have same objects
- Subject: Re: Comparing 2 Arrays if they have same objects
- From: Ricardo Strausz <email@hidden>
- Date: Fri, 5 Sep 2003 13:14:13 -0500
The first thing that comes to my mind is to use NSSets (but there may
be an easer solution):
1. construct a couple of Sets to be compared:
setA = NSMutableSet.set(publications.objectsForKey("author"));
setB = NSSet.set(filteredAuthors);
2. check for the intersection:
setA.intersectSet(setB);
if(setA.count()==0) // there is no intersection
else setA.anElement() // is an element in both arrays.
Suerte!
Dino
But wait, are you using EOF??
if so, simply filter your authors, say in arrayA, and ask for their
publications (with something like arrayA.objectsForKey("pubs")), and
bind them to a DisplayGroup (or equivalent).
This is part of the power of relations.
On jueves, sept 4, 2003, at 05:33 America/Mexico_City, Christian
Telepski wrote:
Hello,
i have a problem:
i have an array of 'publications' and relational to that every
'publication' has many 'authors'. every 'author' has only one
'publication'.
Additional i have a filtered array of 'authors' and want check each
'publication' if one of those 'authors' is relational to the
'publication'.
How do i do it?
The application should decide if the 'publication' should be shown. It
should only be shown if at least one of the 'authors' in the filtered
array is one of these 'authors' of the publication.
I thought of a repetition list programatically.
It should check each 'publication' and then each 'author' if it is in
the other array...
Any Ideas?
Please help.
Thanx in advance
Christian Telepski
_______________________________________________
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.
_______________________________________________
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.