Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Function empty() and null value
Message
 
General information
Forum:
Visual FoxPro
Category:
Other
Environment versions
Visual FoxPro:
VFP 9 SP1
Miscellaneous
Thread ID:
01516146
Message ID:
01516157
Views:
47
>Hi,
>
>When using SQL Server and allowing NULL in empty dates I came across a small issue where EMPTY( date_field) returns .F. when the entry in date_field is NULL. And this of course breaks a lot of code where the program relied on the date field being empty. I am thinking of creating a simple function like this:
>
>Function MyEmpty
>lparameter tDate
>if empty( tDate) or isnull( tDate)
>   return .T.
>else
>  return .F.
>endif 
>
>
>And replace everywhere in the program where I use
>
>if EMPTY( date_field ) 
>
>with
>
>if MyEmpty( date_field )
>
>
>Can anybody see a potential problem with the above approach? TIA.

This approach is fine. In fact, at my former place we used this exact approach and called this function XEmpty.
If it's not broken, fix it until it is.


My Blog
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform