Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Defaulting parameter to null
Message
From
20/09/2019 09:24:41
Cetin Basoz
Engineerica Inc.
Izmir, Turkey
 
 
To
20/09/2019 01:33:06
Walter Meester
HoogkarspelNetherlands
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
01670958
Message ID:
01670994
Views:
46
>>You can do that indirectly without using pcount() or parameters() (I seldom use them). When you don't pass a parameter, by "default" it is boolean false or simply empty() - in VFP .F. is empty.
>>Thus you could do this:
>>
>>
>>parameters tuSomeParameter
>>*tuSomeParameter = evl(m.tuSomeParameter, < valueYouwantAsDeafult >)
>>tuSomeParameter = evl(m.tuSomeParameter, .null.)
>>
>
>That is not the same. If a boolean .F. value is passed you are converting that to a NULL while it should not. The only solution is to use PCOUNT() or PARAMETERS() in order to find out whether the variable has been passed or simply contains a .F.
>
>Walter,

I don't think someone using VFP would ever want to pass a boolean where .null. as chosen default value.
Çetin Basöz

The way to Go
Flutter - For mobile, web and desktop.
World's most advanced open source relational database.
.Net for foxheads - Blog (main)
FoxSharp - Blog (mirror)
Welcome to FoxyClasses

LinqPad - C#,VB,F#,SQL,eSQL ... scratchpad
Previous
Reply
Map
View

Click here to load this message in the networking platform