• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Attempting to get distinct values from an entity's attribute
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Attempting to get distinct values from an entity's attribute


  • Subject: Attempting to get distinct values from an entity's attribute
  • From: "Jon C. Munson II" <email@hidden>
  • Date: Tue, 17 Feb 2009 10:35:11 -0500
  • Organization: JTA Enterprises LLC

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

  • Follow-Ups:
    • RE: Attempting to get distinct values from an entity's attribute
      • From: "Jon C. Munson II" <email@hidden>
  • Prev by Date: Re: At what point during loading can NSPersistentDocument fetch?
  • Next by Date: Still can't get NSFormatter working....
  • Previous by thread: Re: Multiple instances of NSApp/NSApplicationLoad()
  • Next by thread: RE: Attempting to get distinct values from an entity's attribute
  • Index(es):
    • Date
    • Thread