Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
How to check if function exists?
Message
From
27/05/2021 13:17:16
Dragan Nedeljkovich (Online)
Now officially retired
Zrenjanin, Serbia
 
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
01680784
Message ID:
01680792
Views:
38
>>>Hi,
>>>
>>>I have a function GetGlobal(2) in my application that shows the name of the DATA folder. But some code runs before this function is defined. And in this cases, I need to use the default application folder.
>>
>>What does you mean by "before this function is defined"? Sounds like a problem that exists only when relying on procedure files. If there's a PRG named GetGlobal() in the project, it's always available.
>>
>>Tamar
>
>Good point. The procedure GetGlobal() does exist. But the value returned from GetGlobal(2) is .F. when the array which is used to get the value is not yet defined. And once the array is defined, then GetGlobal(2) returns the folder name. So, what I did with the Dragan's suggestion is as follows:
>
>if type("GetGlobal(2)") = "C"
>   *--  Array is define and GetGlobal(2) returns a valid folder name
>else
>   *-- Array is not yet define and GetGlobal(2) SHOULD NOT be used
>endif 
>
>
>Please let me know if the above is not correct.

Aha, just "some other check", like I said in reply to Tamar.

back to same old

the first online autobiography, unfinished by design
What, me reckless? I'm full of recks!
Balkans, eh? Count them.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform