Consultor Eletrônico



Kbase P8457: OUTPUT TABLE-HANDLE or OUTPUT DATASET-HANDLE parameter appear not to be working
Autor   Progress Software Corporation - Progress
Acesso   Público
Publicação   04/07/2005
Status: Verified

FACT(s) (Environment):

Progress 9.x
OpenEdge 10.x

SYMPTOM(s):

Calling procedure with OUTPUT TABLE-HANDLE or OUTPUT DATASET-HANDLE parameter(s)

Parameters are passed BY-VALUE

Called procedure returns errors

The following errors occur:

Invalid Widget-handle Not initialized or points to an invalid widget(3135)

Cannot access the <attribute name> attribute because the widget does not exist. (3140)

CAUSE:

This is expected behavior.

When passing by-value, no definitions are sent to the called procedure for OUTPUT parameters.
Without these definitions it is not possible to automatically create a dynamic object in the called procedure that matches the object in the calling procedure, so no attempt is made to do this and the OUTPUT TABLE-HANDLE or OUTPUT DATASET-HANDLE parameter will at first be an uninitialized (invalid) handle.

FIX:

Basically, there are three ways to solve the problems that occur as a result of this behavior. The approach to use depends on the application requirements.

1. Use INPUT-OUTPUT parameters instead of OUTPUT parameters.
Input or input-output parameters will pass the definition of the object to the called procedure. The downside is that the data will be passed along as well, which may result in an unnecessary overhead.

2. Bind the handle in the called procedure to a valid object.
This can be done by using the handle to create the object from scratch, or by assigning it the HANDLE attribute from an already defined/created object.
When the parameter is passed back to the calling procedures the definitions will be checked if the calling procedure passed a static object as parameter. Thus, care must be taken to ensure the definitions passed back are the ones that are expected by the calling procedure.

3. Pass the object BY-REFERENCE.
Passing by-reference will bind the parameter to the actual object being passed as a parameter instead of having to maintain a second copy.
Do note that when passing BY-REFERENCE, the input/output mode of the parameter effectively no longer matters. This results in behavior that is very different from passing by-value, which will need to be taken into account when writing the called procedure.
At the time of writing, this is only available in OpenEdge 10.0x for the ProDataSet objects.