Re: KVC NSArray attribute to double[] ?
Re: KVC NSArray attribute to double[] ?
- Subject: Re: KVC NSArray attribute to double[] ?
- From: James Cicenia <email@hidden>
- Date: Sun, 27 Aug 2006 21:08:47 -0500
Sacha -
That gives me a compiler error. I tried that too. Searched around ...
I guess I just have to loop through.
- James
On Aug 27, 2006, at 8:51 PM, Sacha Michel Mallais wrote:
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@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden