Passing OUTPUT PARAMETER TABLE-HANDLE from Procedure to .NET

Posted by Admin on 09-Jul-2009 07:45

Hi,
I am trying to pass an OUTPUT PARAMETER TABLE-HANDLE from Procedure to .NET application. Unfortunately while executing my code it says that I am trying to pass a mismatch parameter type.


.NET Code:

Dim Handle As Progress.Open4GL.Handle


Dim parms As ParameterSet = New ParameterSet(1)


parms.setHandleParamete(1,Handle,ParameterSet.OUTPUT)

ABL CODE:

DEFINE TEMP-TABLE ttOutput

      FIELD test AS CHARACTER FORMAT "X(4)" INITIAL "some_text"

      INDEX idxtest IS UNIQUE test.

DEFINE OUTPUT PARAMETER TABLE-HANDLE ttOutput.

RETURN.

What should I change in my code?

BTW: I am also looking for a documentation for Progress.Open4GL.DynamicAPI
regards

All Replies

Posted by Admin on 09-Jul-2009 08:46

hi,

don't loose your time to search the API documentation of DynamicAPI

because you found nothing. There are some informations but very limited in information.

http://communities.progress.com/pcom/docs/DOC-19768

In the mean time we can "jad" the DynamicAPI (java version).

The .Net version keeps the same names of class methods parameters,

.Net language is very close of java.

May be helps.

[View:~/cfs-file.ashx/__key/communityserver-discussions-components-files/26/dynamicapi.zip:550:0]

Posted by Admin on 09-Jul-2009 12:45

Nice to see you again 'stanciu'. You were answered to me on ProgressTalk regarding API documentation.

I was looking throug ParameterSet class and find out that I need to use setHandleParameter (my guess based on method name within this class).

But right now I have a 'mismatch parameter' when trying to execute my code.

So If usage of this class is similar in java and .NET maybe you know what is wrong with my code?

The method setHandleParameter (function) within ParameterSet class is defined as following:

public void setHandleParameter (int i, Handle handle, int j)

     throws Open4GLExeption

(

     setParameter(i, handle, j, 10, false, 0);

)

Posted by Admin on 10-Jul-2009 00:03

I am trying to pass an OUTPUT PARAMETER TABLE-HANDLE from Procedure to .NET application. Unfortunately while executing my code it says that I am trying to pass a mismatch parameter type.

An ABL temp-table or table-handle is not returned as a handle to the dot net set. Even in the ABL it's a huge difference if you pass a temp-table using a handle or a table-handle parameter.

parms.setHandleParamete(1,Handle,ParameterSet.OUTPUT)

Instead, try one of these (methods of the Progress.Open4GL.DynamicAPI.ParameterSet):

public virtual void setDataTableParameter(int position, System.Data.DataTable r, int m)

or

public virtual void setDataTableParameter(int position, System.Data.DataTable r, int m, string strongTypeName)

Documentation may not be in the book, but in the class object browser in Visual Studio . My assumption is, that the strongTypeName allows you to name a typename of a strong typed datatype class and in instance of that tytpe is returned.

By the way: Why do you need the Dynamic API at all? I've always got along with methods generated into the proxy. I usually did not need that many! I used a sort of generic call interface (like an OERA service interface) that's able to talk to any number of business services on the AppServer. Using the Dynamic API basically creates a dependency between changes in the ABL code (parameter definitions) and consistency with those in the .NET code. Using generated methods in the proxy, this types of issues show up after rebuilding the proxy and recompiling the .NET solution. Using the Dynamic API they may only show up after long intensive manual tests.

The error you just ran into is just one sample of those!

Posted by Admin on 10-Jul-2009 13:14

Hi,

thank for your answer...

First of all I need to say that I am begginer regarding VB.NET and 4GL/ABL. I am rather a self lerning person. I know that it's painfull way of learning but...

I did a try with the setDataTableParameter and compilation went smoothly. I will let you know if execution of code will also be ok.

I am trying to customize a VANTAGE ERP system. It provides some kind of very limited IDE that allows to add a controls to application and also write a code in VB.NET. It provides some classes that can be used so I am using it to connect to openedgee session:

...

Dim ThisProgressSession As Progress.Open4GL.DynamicAPI.Session = Nothing

Dim ThisSession As Epicor.Mfg.Core.Session = oTrans.EpiBaseForm.Session


Try

     ThisProgressSession = ThisSession.ConnectionPool.Get()

...

So as far as I understood I am using a session that is already established.

This Vantage IDE hava also possibility to browse a classes but only from embeded assemblies. After adding a o4glrt.dll to project there is no possibility to browse a methods/properties within it. It was the reason why I was looking for documntation for Progress.Open4GL.DynamicAPI.

Of course the best solution it will be to use a ProxyGen as you wrote. But I don't have it. Toogether with Vantage we also have a limited installation of OpenEdgee. I can't find a ProxyGen in this installation and therefore I was trying to find a resolution that allows me to go forward without ProxyGen.

I will try to do something with setDataTableParameter but if you have any example that is showing how to:

1. Defining OUTPUT parameter in Progress Procedure that will correspond to setDataTableParameter in VB.NET

2. Read back this parameter in VB.NET and display i.e one field

it will be very usefull and it will save my time.

Posted by Admin on 10-Jul-2009 15:02

It seems like I did it.

The ABL/4GL Code:

DEFINE TEMP-TABLE ttOutput
    FIELD test AS CHARACTER FORMAT "X(4)" INITIAL "some_text"
    INDEX idxtest IS UNIQUE test.

DEFINE OUTPUT PARAMETER TABLE FOR ttOutput.
CREATE ttOutput.

RETURN.

VB.NET Code: (only the clue)

Dim Tabela as System.Data.DataTable

Tabela = New DataTable
Tabela.Columns.Add("test" , GetType(String))
Dim parms As ParameterSet = New ParameterSet(1)

parms.setDataTableParameter(1,Tabela,ParameterSet.OUTPUT)

     ...running procedure...
Tabela = parms.GetOutputParameter(1)

I am just wondering if memory for ttOutput will be released as soon as procedure will finish or it will be released when I will release (ConnectionPool.Release) Progress session?

Posted by Admin on 10-Jul-2009 15:11

I am just wondering if memory for ttOutput will be released as soon as procedure will finish or it will be released when I will release (ConnectionPool.Release) Progress session?

It should - I don't knnow anything about Epicors implementation, but if the API would keep a reference to the output table handle object that would be bad (the Progress Proxy or Dynamic API won't do that).

If general .NET rules apply in your environment, the datatable will be in memory until you Dispose it (calling the Dispose() method) or the last reference to the datatable is gone. Be aware the the last reference might also be kept by an databound UI element.

This thread is closed