• 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: NULLS and Formatters
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NULLS and Formatters


  • Subject: Re: NULLS and Formatters
  • From: "Jerry W. Walker" <email@hidden>
  • Date: Mon, 15 Aug 2005 06:35:31 -0400

Hi Colin,

On Aug 15, 2005, at 1:03 AM, Colin Shreffler wrote:

I’m displaying data in a WORepetition.

Null values are being displayed as “()”.  How do I get the repetition to not display anything at all when the value is a null?

The element you're displaying here is not a Null value, but rather an empty array.

Also, in cases  where multiple child records exist in one column for the record being retrieved, those values are displayed in combination:

(“Kitchen”, “Cabinet”)

It seems that you have a WORepetition used to display one of the properties of your Enterprise Object as a WOString and that property is a to-many relationship, so the value received when you fire the fault for that property is an NSArray. If you try to display an NSArray in a WOString, then you will get exactly the values that you are seeing.

I’d like to create a formatter to change how these values are displayed, for example:

Kitchen, Cabinet

How do you create a formatter to do this?

There is no formatter to format an NSArray for a WOString. However, to do what you want, you might set up a nested WORepetition to display the elements of the array, or provide an accessor method of that property that builds the kind of string from the NSArray that you're looking for. In this regard, take a look at the NSArray method:

   public String componentsJoinedByString(String separator)

That should turn your array into the kind of string you wish to print.

However, for an empty NSArray value, you will still get an empty string rather than a Null value, so your WORepetition will still display a blank value rather than skipping the property. If that's a problem, use a WOConditional to avoid displaying that element if blank, thereby effectively skipping it.

Good luck.

Regards,
Jerry


--

__ Jerry W. Walker, Partner

    C o d e F a b, LLC - "High Performance Industrial Strength Internet Enabled Systems"

    email@hidden

    212 465 8484 X-102  office

    212 465 9178        fax



 _______________________________________________
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

References: 
 >NULLS and Formatters (From: Colin Shreffler <email@hidden>)

  • Prev by Date: Re: Inserting records into to-many relationship
  • Next by Date: Re: Inserting records into to-many relationship
  • Previous by thread: NULLS and Formatters
  • Next by thread: Re: NULLS and Formatters
  • Index(es):
    • Date
    • Thread