Passing temp-table as parameter and receiving updated fields

Are

New Member
Hello,
I'm passing a temp-table as parameter to an external procedure. I update the temp-table in proc2 and I want to see the updated fields in proc1, but I can't. It's just 1 record in ordre.

What is wrong here ?

regards
Per

proc1.
def temp-table ordre
.
.
run proc2.p((BUFFER ordre:HANDLE)).
disp ordre with 1 down.

proc2.

DEFINE INPUT PARAMETER lBuffer AS HANDLE NO-UNDO.
def temp-table ordre
.
.

DEFINE VARIABLE lBuffer-b AS HANDLE NO-UNDO.

CREATE ordre.
lBuffer-b = BUFFER ordre:HANDLE.
lBuffer-b:BUFFER-COPY(lBuffer).

updating fields in ordre here..

.
.
.
.
 

jongpau

Member
Hi,

Try something like this:

Create an include ttTest.i
Code:
/* ttTest.i */
DEFINE TEMP-TABLE ttTest NO-UNDO
FIELD custNum AS INT
FIELD custName AS CHAR
INDEX iDef IS PRIMARY custNum.

Next create procedure proc1.p
Code:
/* proc1.p */
{ttTest.i}
 
RUN proc2.p (INPUT-OUTPUT TABLE ttTest).
 
FOR EACH ttTest:
  DISP ttTest.
END.

And create procedure proc2.p
Code:
/* proc2.p */
{ttTest.i}
DEFINE INPUT-OUTPUT PARAMETER TABLE FOR ttTest.
 
CREATE ttTest.
ASSIGN ttTest.custNum = 1
ttTest.custName = "Customer 1".

If you are on OpenEdge (version 10) you can also pass the temp-table reference-only so you only have 1 single copy of the table in memory, which is of course more efficient (note that this of course does not count across AppServer boundaries).

HTH

Paul
 

jongpau

Member
Hi,
How do we pass Buffer as an Input parameter to a method in a class. Can anyone help me with an example.?

It would be better if you would create a new topic for this at it is a different question, but anyway.

It should be pretty much the same as it is in a procedure:
Code:
class abc:
 
  method public logical testBuffer(buffer <buffername> for <tablename>):
    return available <buffername>.
  end method.
 
end class.
 
def var foo as class abc no-undo.
 
foo = new abc().
 
find first <tablename>.
 
message foo:testBuffer(buffer <tablename>) view-as alert-box.
 
delete object foo.
 
Top