• 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: Florijan Stamenkovic <email@hidden>
  • Date: Mon, 15 Aug 2005 13:29:40 +0200


On Aug 15, 2005, at 07:03, 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?

Wonders can be done by binding WOConditional's condition to keys, array counts, integers etc... Basically you can bind it to just about everything, and if you get a null reference, or a 0 value, or a false, it will treat it all as a false.



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


 (“Kitchen”, “Cabinet”)

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?

Besides what Jerry suggested, you could also define a method returning string in the EO you are repeating (if indeed we are talking about a to-many relationship). That way you can do just about anything you like with the array you get for a to-many, extract what you need and concatenate it into a String in whatever format. Something like


public String toManyRepresentation()
{
	NSArray toMany = toMany();
	if(toMany.count == 0)
		return "No related objects";
	StringBuffer buff = new StringBuffer();
	buff.append("The relationship is: ");
	for(int i = 0 ; i < toMany.count() ; i++)
	{
		if(....)
			buff.append("...");
		//all the other complicated logic of presenting data
	}
	return buff.toString();
}


Thanks -c

Cheers F

_______________________________________________
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: Identifying changed fields
  • Previous by thread: Re: NULLS and Formatters
  • Next by thread: Interfacing WebObjects with QuickBooks ?
  • Index(es):
    • Date
    • Thread