• 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
Re: Using a text formatter on a WOBuilder WOString object
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Using a text formatter on a WOBuilder WOString object


  • Subject: Re: Using a text formatter on a WOBuilder WOString object
  • From: Jonathan Rochkind <email@hidden>
  • Date: Wed, 18 Jun 2003 10:38:11 -0500

Okay, you really don't want to use a formatter to deal with an NSArray. You also don't want to redesign your db schema---it shouldn't be neccesary.

You just need to understand what's going on. From what you've told us, it's very difficult to figure out what the problem is. You need to figure out _why_ you are getting an array when you expect to get a single value. If it's because of a to-many relationship, then the array _could_ conceivably contain more than one value, and you should plan for this instead of assuming it's only one value. If you _know_ (somehow) it's only one value even though the EOModel allows for it to be more than one, than you can use lastObject() in Java code (or just the key .lastObject in WOBuilder bindings) to get the one value from the array. But this would be an odd thing to do---why is the model set up with a to-many relationship, if really there can only be one object in the destination? If your model is set up to have a to-many relationship that should really be a to-one, then maybe your model does need to be fixed.

But you don't need to change your model just to get this component to work. You just might want to display your model if it's set up _incorrectly_, if it doesn't properly model your data domain.

Be aware also that you _can_ have a WORepetition _inside_ of another WORepetition. Ad infinitum. If your model and bindings and really set up right, but you're getting an NSArray that you want to output---why not just put another WORepetition inside there, that interates over your terminal NSArray, and outputs the elements inside one by one with a WOString?

If it's still not clear what you should do... it's not clear to me either, becuase I don't really understand what's going on or why you are having a problem in the first place. Maybe try explaining more, using the actual names (and short explanations, if neccesary) of the entites and relationships involved, and of exactly what you have bound to the WORepetition 'list' and 'item' bindings.

--Jonathan

At 06:25 PM 6/17/2003 -0700, Nat Fast wrote:
Unless I have misunderstood, the problem is that a to-many relationship is
being inlcuded in a keypath whenn a single object resultis wanted.
Calling
valueForKey on an NSArray yields an NSArray.

Chuck is correct. The repetition is iterating over rootRec. The to many relationship is in the middle of an extensive keypath that leads to a string object.

It returns the correct value, just in the wrong format for display. While it may be "proper" to reform the database to alleviate this issue, it would remove the normalcy of data I have been pushing towards in that I would have to duplicate the values in the higher order object A. EO Modler will not allow me to create a one-to-one for the class in that the primary key is different.

So unless there is some great wisdom out there, I guess I am in Kludge land. So how do those formatters work?

Nat
_______________________________________________
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.

References: 
 >Re: Using a text formatter on a WOBuilder WOString object (From: Chuck Hill <email@hidden>)
 >Re: Using a text formatter on a WOBuilder WOString object (From: Nat Fast <email@hidden>)

  • Prev by Date: Re: deleting array relational to an object
  • Next by Date: Re: deleting array relational to an object
  • Previous by thread: Re: Using a text formatter on a WOBuilder WOString object
  • Next by thread: Re: MacOSX and MS Sql Server - jdbc drivers?
  • Index(es):
    • Date
    • Thread