Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Return Multiple Values From a UDF
Message
From
21/01/2005 12:02:53
Dragan Nedeljkovich (Online)
Now officially retired
Zrenjanin, Serbia
 
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Environment versions
Visual FoxPro:
VFP 9
Miscellaneous
Thread ID:
00979276
Message ID:
00979325
Views:
16
>To All:
>IS there a way in VFP to return multiple values from a User Defined Function? I don't want to use an Array, then I have to pass by reference and I am trying to avoid that. I have thought about casting and concatenating the values to a single string then returning that and parsing it when needed but I know there has to be a 'cleaner' way to accomplish this.

Since you didn't say whether the values to return are in any way connected to parameters, or does the routine need parameters at all, here's a version of the previous solutions which returns an object:
oReturn=myudf()
?oReturn.value1
?oReturn.value2

procedure myudf
oRet=createobject("empty")
AddProperty(oRet, "value1","first value")
AddProperty(oRet, "value2",datetime())
return oRet

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