RE: Attempting to get distinct values from an entity's attribute
RE: Attempting to get distinct values from an entity's attribute
- Subject: RE: Attempting to get distinct values from an entity's attribute
- From: "Jon C. Munson II" <email@hidden>
- Date: Tue, 17 Feb 2009 12:20:17 -0500
- Organization: JTA Enterprises LLC
Doh!
The one permutation I DIDN'T try was: "@distinctUnionOfObjects". I
incorrectly reported that I did...
And that, fixed that...
Sorry for the noise!!!
Peace, Love, and Light,
/s/ Jon C. Munson II
> -----Original Message-----
> From: cocoa-dev-bounces+jmunson=email@hidden [mailto:cocoa-dev-
> bounces+jmunson=email@hidden] On Behalf Of Jon C. Munson II
> Sent: Tuesday, February 17, 2009 10:35 AM
> To: 'Cocoa-Dev List'
> Subject: Attempting to get distinct values from an entity's attribute
>
> Namaste!
>
> I'm having trouble with the following code snippet:
>
> ...
>
> NSString theKey = @"entity.@distinctUnionOfObjects.";
> theKey = [theKey stringByAppendingString:[aFilterFields
> objectAtIndex:[popupFilterOn indexOfSelectedItem]]];
>
> // the above two lines produce something like:
> // @"email@hiddenbutePath"
>
> aFilterableValues = [resultSet valueForKeyPath:theKey];
>
> ...
>
> I am getting an NSException on the third line (valueForUndefinedKey,
> etc.).
> "entity" is the name of the entity from which I am attempting to retrieve
> distinct values for a certain attribute. aFilterFields is an array that
> holds the attribute's true name/key path, and popupFilterOn contains the
> human-oriented version of that name (and is linked to the XIB's relevant
> popup). resultSet is the array of "entity"s in which I am interested.
>
> If there are any typos, I re-typed this as my mail client is on a
> different
> machine - syntactically everything runs fine.
>
> What I'm trying to do: obtain a list of the distinct values of a given
> attribute in an entity. In SQL, this is trivial.
>
> I. Savant re-pointed me back to "distinctUnionOfObjects" and thus my use
> of
> it.
>
> I did try simply (because I could):
>
> NSString theKey = @" distinctUnionOfObjects.";
>
> and
> NSString theKey = @"@distinctUnionOfObjects.";
>
> with the same result.
>
> After re-reading the Apple dox a few times, it occurs to me that this may
> be
> an inappropriate use of "distinctUnionOfObjects," as it, and its siblings,
> in the example snippets Apple provided, was used to return distinct
> entities
> as opposed to attribute values. 'Course that may be the sample and have
> nothing to do with the issue...
>
> If this isn't the right way to go about this, that's fine - I'd appreciate
> a
> suggestion for an efficient manner of addressing my issue.
>
> If anyone wouldn't mind setting me straight on this, I'd appreciate it.
>
> Many thanks in advance!
>
> Peace, Love, and Light,
>
> /s/ Jon C. Munson II
>
>
> _______________________________________________
>
> Cocoa-dev mailing list (email@hidden)
>
> Please do not post admin requests or moderator comments to the list.
> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
>
> Help/Unsubscribe/Update your Subscription:
>
> This email sent to email@hidden
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden