I knew it existed!  Thanks Aaron!

Ken

On Dec 20, 2013, at 11:53 AM, Aaron Rosenzweig <[email protected]> wrote:

> Hi WOrriors,
> 
> A little late to the party but wanted to pass along that if you go to the 
> “entity” you can create an “identity qualifier” that works everywhere 
> including when you have a compound primary key.
> 
> For giggles, it would look something like so:
> 
> EOEntity entity = EOUtilities.entityForObject(eo.editingContext(), eo);
> EOKeyGlobalID globalID = (EOKeyGlobalID) 
> eo.editingContext().globalIDForObject(eo);
> NSDictionary primaryKey = entity.primaryKeyForGlobalID(globalID);
> EOQualifier identityQualifier = entity.qualifierForPrimaryKey(primaryKey);
> 
> Cheers,
> AARON ROSENZWEIG / Chat 'n Bike
> e:  [email protected]  t:  (301) 956-2319
>       
> 
> On Dec 17, 2013, at 9:22 AM, Ken Anderson <[email protected]> wrote:
> 
>> Samuel,
>> 
>> Thanks - this is the most elegant approach I’ve found!
>> 
>> Ken
>> 
>> On Dec 10, 2013, at 12:49 PM, Samuel Pelletier <[email protected]> wrote:
>> 
>>> OK, next try…
>>> 
>>> If you qualify in memory, you may use the key "self" with an equals 
>>> operator.
>>> ERXQ.notEquals("self", studentToRemove);
>>> 
>>> If you qualify in database, I found a working solution. Add a method to 
>>> your entity class that return a qualifier like this:
>>> 
>>> public ERXKeyValueQualifier notMeQualifier() {
>>>     return ERXQ.notEquals("id", 
>>> ERXEOControlUtilities.primaryKeyObjectForObject(this));
>>> }
>>> 
>>> "id" need to be replaced by your primary key attribute name, this attribute 
>>> does not need to be visible (class attribute) and this will only work for 
>>> single column primary key.
>>> 
>>> Samuel
>>> 
>>> 
>>> Le 2013-12-10 à 09:34, Ken Anderson <[email protected]> a écrit :
>>> 
>>>> Samuel,
>>>> 
>>>> Yes, of course…  but the qualifier is passed through many levels of API - 
>>>> so not so easy.  Thanks for chiming in.
>>>> 
>>>> Ken
>>>> 
>>>> On Dec 10, 2013, at 8:23 AM, Samuel Pelletier <[email protected]> wrote:
>>>> 
>>>>> Hi,
>>>>> 
>>>>> A simple solution is to add a line to your fetch method.
>>>>> 
>>>>> students = fetch Students where grade > 80 ;
>>>>> 
>>>>> students = ERXArrayUtilities.arrayMinusObject(students, studentToRemove); 
>>>>>  <<— Line to add
>>>>> return students;
>>>>> 
>>>>> Samuel
>>>>> 
>>>>> Le 2013-12-08 à 12:44, Ken Anderson <[email protected]> a écrit :
>>>>> 
>>>>>> No, I already have an EO I want to exclude...  Not an attribute of an EO.
>>>>>> 
>>>>>>> On Dec 8, 2013, at 12:39 PM, Theodore Petrosky <[email protected]> 
>>>>>>> wrote:
>>>>>>> 
>>>>>>> Student.STUDENT_LAST_NAME.notIn("Smith")
>>>>>>> 
>>>>>>> from what I see there is:    "in", "notIn", "inObjects", "noInObjects"
>>>>>>> 
>>>>>>> is this what you are looking for?
>>>>>>> 
>>>>>>> 
>>>>>>> 
>>>>>>> 
>>>>>>>> On Dec 7, 2013, at 11:01 PM, Ken Anderson <[email protected]> 
>>>>>>>> wrote:
>>>>>>>> 
>>>>>>>> All,
>>>>>>>> 
>>>>>>>> I know I’ve done this before, but I do it seldom enough that I can’t 
>>>>>>>> remember.  I want to create a qualifier to select a bunch of objects 
>>>>>>>> but to exclude one of the objects that might match the qualifier:
>>>>>>>> 
>>>>>>>> Give me all the Students where grade > 80 and Student is not “Joe 
>>>>>>>> Smith”
>>>>>>>> 
>>>>>>>> How do I do that again?  and is there any special whizzy wonder ERX 
>>>>>>>> Key to do it?
>>>>>>>> 
>>>>>>>> Thanks,
>>>>>>>> Ken
>>>>>>>> _______________________________________________
>>>>>>>> Do not post admin requests to the list. They will be ignored.
>>>>>>>> Webobjects-dev mailing list      ([email protected])
>>>>>>>> Help/Unsubscribe/Update your Subscription:
>>>>>>>> https://lists.apple.com/mailman/options/webobjects-dev/tedpet5%40yahoo.com
>>>>>>>> 
>>>>>>>> This email sent to [email protected]
>>>>>>> 
>>>>>> 
>>>>>> _______________________________________________
>>>>>> Do not post admin requests to the list. They will be ignored.
>>>>>> Webobjects-dev mailing list      ([email protected])
>>>>>> Help/Unsubscribe/Update your Subscription:
>>>>>> https://lists.apple.com/mailman/options/webobjects-dev/samuel%40samkar.com
>>>>>> 
>>>>>> This email sent to [email protected]
>>>> 
>>> 
>> 
>> _______________________________________________
>> Do not post admin requests to the list. They will be ignored.
>> Webobjects-dev mailing list      ([email protected])
>> Help/Unsubscribe/Update your Subscription:
>> https://lists.apple.com/mailman/options/webobjects-dev/aaron%40chatnbike.com
>> 
>> This email sent to [email protected]

 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list      ([email protected])
Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to [email protected]

Reply via email to