Re: Hiding NSKeyValueCoding$Null
Re: Hiding NSKeyValueCoding$Null
- Subject: Re: Hiding NSKeyValueCoding$Null
- From: Jonathan Rochkind <email@hidden>
- Date: Tue, 09 Sep 2003 12:03:57 -0500
Well, if we think about what's going on, if you ask an NSDictionary for a
key that doesn't even exist in the NSDictionary, it will return null. So
you need the EOKeyValueCoding.NullValue in there to tell the difference
between a database-supplied null value, and an actual empty key/value
pair. When dealing with EOs, on the other hand, you have defined
attributes and relationships for that entity, so when asking for the value
of one of these defined properties, if it's null in the db, it gives you a
Java null value, you know exactly what that means.
So there's no way to change the fetch to do anything useful to you. That's
just the way it works.
What you really want to do is change your display code that is displaying
it. You can put a WOConditional around it to not display anything if the
value is a NullValue. You can bind the WOString to a method that checks if
the value is a EOKeyValueCoding.NullValue, and returns some more pleasant
human-readable string (or the empty string, or the Java null value) in that
case. Returning the actual value (if that's what you want) in other cases.
There are a variety of ways to do it. There's no one simple automatic way
to just magically fix things. You've just got to write logic to do what you
want.
Hope this makes sense,
--Jonathan
At 05:41 PM 9/9/2003 +0100, Merul Patel wrote:
Hi,
I'm fetching a large data set using a raw row fetch since I don't need to
initially instantiate any EOs for the returned objects.
When I bind any key from a dictionary in the returned array to a WOString,
I'm getting an unsightly value for those fields that contain null values:
<com.webobjects.foundation.NSKeyValueCoding$Null>
If I change the fetch to return EOs then null fields are correctly
displayed, so is there a simple way to do the same for WOStrings bound to
NSDictionary keys?
Thanks,
Merul
_______________________________________________
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.