Try OpenEdge Now
skip to main content
.NET Open Clients
Using the Open Client .NET OpenAPI to Directly Access the AppServer : Handling returned values : Accessing user-defined function return values
 

Accessing user-defined function return values

You can access the return value after running any user-defined function using the ReturnValue property on the Progress.Open4GL.Proxy.ParamArray object. This is the syntax:

Syntax

public System.Object ReturnValue
You need to cast the return Object to the correct return type for the function. For example:
string retVal = (string) parms.ReturnValue;
The subclass of System.Object that is returned depends on how you define the return type for a given function. For more information, see Defining the return type for a user-defined function.
When the return value is an array, the Progress.Open4GL.Proxy.ParamArray.IsReturnArray property will be TRUE. Since the ReturnValue property returns an object, you can cast it to an array.
ParamArray parms = new ParamArray(1);
...
// Set up return type (udf does not return an unknown value)

parms.ReturnType = Parameter.PRO_DECIMAL;
parms.IsReturnExtent = true;

// Run procedure
openPO.RunProc("GetOrderTotalsByDollar", parms);

// Get return value
System.Decimal[] retValArray = (System.Decimal[])parms.ReturnValue;
Note: User-defined functions returning LONGCHAR or MEMPTR values cannot be run across the Open Client interface.