Icon View Thread

The following is the text of the current message along with any replies.
Messages 1 to 2 of 2 total
Thread Detecting a null string
Mon, Dec 12 2016 10:49 AMPermanent Link

Matthew Jones

Way back in 2013, in EWB v1, you could detect a null value for a string with a compare against nil.
http://www.elevatesoft.com/forums?action=view&category=ewb&id=ewb_general&page=1&msg=2200#2200

This no longer works. When I use GetProperty on a field that doesn't exist, the result value is null in this case.
I put in an "if assigned(mystring) then" to use another method, but this then doesn't discriminate between null and an empty string.

How can I know it is null?

(If anyone else has this, the particular workaround is to use PropertyType() to check it exists, but the general question still exists given that external interfaces could return null...)

--

Matthew Jones
Wed, Dec 14 2016 3:06 PMPermanent Link

Tim Young [Elevate Software]

Elevate Software, Inc.

Avatar

Email timyoung@elevatesoft.com

Matthew,

<< This no longer works. When I use GetProperty on a field that doesn't exist, >>

Don't do that.  GetProperty is only intended to be used in cases where the property actually exists, thus avoiding any "undefined" issues, etc.  It's isn't intended to be a full-on replacement for hash key-value access to the underlying JS object properties.

Tim Young
Elevate Software
www.elevatesoft.com
Image