Re: Using NSArray functions in WO
Re: Using NSArray functions in WO
- Subject: Re: Using NSArray functions in WO
- From: "Adam Chan" <email@hidden>
- Date: Thu, 11 Sep 2003 09:23:01 -0600
That is the way how the example EOModel was set. The class "Agent" has a
to-many relation to a EOEntity called "Rating", and this "Rating" class has
a class poperty called "rating" which returns a Number.
----- Original Message -----
From: "Ray Ackland" <email@hidden>
To: <email@hidden>
Sent: Thursday, September 11, 2003 2:15 AM
Subject: Using NSArray functions in WO
> In the book "Enterprise Objects" there is an example of using NSArray
> functions. In the code snippet (located in
> /Developer/Examples/JavaWebObjects/Frameworks/JavaRealEstate), the
> webobjectsexamples.realestate.server.Agent class goes:
>
> public Number averageRating() {
> if (_averageRating == null) {
> _averageRating =
> (Number)(ratings().valueForKey("@avg.rating.rating"));
> }
> return _averageRating;
> }
>
> I am trying to understand the parameters given. Specifically, the
> ratings() refers to the array of EO objects, the @avg means average,
> but what are the two ratings for? I expect one of them is saying to
> average the values in the rating field, but what about the other?
>
> I have used a similar expression in my code, but only having one part
> following the @operator, with success. Am I missing something of
> importance?
>
> Thanks,
>
> Ray.
> _______________________________________________
> webobjects-dev mailing list | email@hidden
> Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/webobjects-dev
> Do not post admin requests to the list. They will be ignored.
_______________________________________________
webobjects-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/webobjects-dev
Do not post admin requests to the list. They will be ignored.