Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Returning Values form Custom Class Method
Message
 
To
29/06/2005 11:56:46
General information
Forum:
Visual FoxPro
Category:
Classes - VCX
Environment versions
Visual FoxPro:
VFP 6 SP5
OS:
Windows XP SP2
Network:
Windows 2000 Server
Database:
Visual FoxPro
Miscellaneous
Thread ID:
01027425
Message ID:
01027443
Views:
10
Steven,

One method is to use output parameters that get passed by reference as Hilmar explained. That approach is very common across multiple languages and is very commonly accepted. Greg gave you another method that works, but tends to be a pain to implement and use with all the extra splitting and converting of values and whatnot. Another method is to return an object which gives you easy access to unlimited return values and types:
loObj = CommonClass.AS400Method()
? loObj.nValue
? loObj.cValue
? loObj.aValue[1]
? loObj.aValue[2]
...
PROCEDURE CommonClass.AS400Method
  LOCAL loReturn AS Empty

  loReturn = NEWOBJECT('Empty')

  ADDPROPERTY(loReturn, 'nValue', 1)
  ADDPROPERTY(loReturn, 'cValue', 'Hello World!')
  ADDPROPERTY(loReturn, 'aValue[2]')

  loReturn.aValue[1] = ID()
  loReturn.aValue[2] = DATETIME()

  RETURN loReturn
ENDPROC
HTH,
Chad

>I have two applications that need to verify a job number data that resides on an AS400 database. I thought it would be better to have a custom class method that either app could access to run the SPT. All is well except my SPT returns two fields of information. How do I get these two pieces of information back to my calling apps? I know how to return one value but not two values without maybe two separate method calls.
_________________________________
There are 2 types of people in the world:
    Those who need closure
Previous
Reply
Map
View

Click here to load this message in the networking platform