On Aug 27, 2006, at 6:22 PM, James Cicenia wrote:

Is there a way to use KVC to:

1) Given an array of EOs
2) Get an array of attribute A1 which is a double.

Not directly.


I was hoping to do:

double[] y = (double[])projects.valueForKeyPath ("calculatedRewardScore");

but this throws an exception.

What am I doing wrong?

valueForKey (and valueForKeyPath) on an NSArray return an NSArray (unless using an aggregate function like @sum, in which case they return a Double IIRC). What you want is (warning, untested code):

double[] y = (double[])((NSArray)projects.valueForKeyPath ("calculatedRewardScore")).objects();


sacha


--
Sacha Michel Mallais             400 kg chimp
Global Village Consulting Inc.   http://www.global-village.net/
PGP Key ID: 7D757B65             AIM: smallais
"Choke on that, causality!"  -- the Professor, "Futurama"


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

This email sent to [email protected]

Reply via email to