Re: Accessing single element from NSArray of objects
Re: Accessing single element from NSArray of objects
- Subject: Re: Accessing single element from NSArray of objects
- From: Randall Perry <email@hidden>
- Date: Tue, 13 Apr 2004 16:29:02 -0400
>> Yeah, I tried using lower case but when I added the binding to ResultPage.wo
>> it made it upper.
>
> I don't understand exactly what you mean, but that makes very little
> sense. I've never had WOBuilder do that to me---but even if
> WOBuilder is for some reason messing up horribly like that, so what,
> don't let it, create the variable/method by hand if you need to.
>
It's because when I initially created the key I had it create accessor
methods. So, for instance, it named getCustInfo instead of getcustInfo.
>
> Of course, EOEnterpriseObject is the superclass, which does not have
> a method cust() in it. If you really do have an attribute called
> 'cust' defined in your model, you _could_ do:
> EOEnterpriseObject eo = (EOEnterpriseObject) custInfo.objectAtIndex(0);
> String value = (String) eo.valueForKey("cust");
>
While re-reading the chapter on EO in Apple's tutorial I got that I should
be casting to the EOModeler class for the table.
Got it working now with this:
public String cust()
{
CustView eo = (CustView) CustInfo.objectAtIndex(0);
String cust = eo.cust();
return cust;
}
>> So there's no shorthand to directly access an object property within an
> array of objects? I can do it in one line in perl, php.
>
> I'm not exactly sure what you want to do, but certainly you can
> directly access an object property within an array of objects within
> one or two lines of code.
>
Can this be condensed into one line?
CustView eo = (CustView) CustInfo.objectAtIndex(0);
String cust = eo.cust();
--
Randall Perry
sysTame
Xserve Web Hosting/Co-location
Website Development/Promotion
Mac Consulting/Sales
http://www.systame.com/
_______________________________________________
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.