On Tue, Aug 11, 2009 at 12:10 PM, Rick Faircloth<r...@whitestonemedia.com> wrote: > What I still don't understand is even how this logic works: > > if ( row[19] ) { > row[19] > } else { > N/A > }
The key part is "if( row[19] )". row[19] is being evaluated for _truth_. Javascript defines (I believe) truth to be "non-false", and false is defined as any of: undefined null 0 "0" (a string with value zero..I think. I may be channeling Perl here) "" (empty string) false (boolean value) So if you are trying to provide a default value in the case of null only, then you should check for null because any of the other "false" (non-null) values will give you your provided default instead. The ( test ? return if true : return if false ) construct allows a full test, so: ( row[19] == null ? "default" : row[19] ) works. If you want to look up more about this sort of construct, it's called the "ternary operator" and exists in many programming languages. -- Brett Ritter / SwiftOne swift...@swiftone.org