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: Christian Telepski <email@hidden>
- Date: Sat, 6 Sep 2003 14:30:46 +0200
Hi Ricardo,
thanks for your reply.
After trying a lot, i have made it.
Is there some documentation on such things? maybe i have missed
something.
I just filtered the array and used relations.
I also tried to use display groups, but without any success.
Anyway thanks a lot.
Chers Christian Telepski
Am Freitag, 05.09.03 um 20:14 Uhr schrieb Ricardo Strausz:
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.