Is there a way to convert a temp-table handle back to the st

Posted by jquerijero on 10-Mar-2014 09:30

I have a handle to a static temp-table that I pass around. Is there a trick so that I can convert the handle parameter back to the static temp-table definition.

Ex.

DEFINE TEMP-TABLE my-table . . .

PUBLIC SomeMethod(INPUT TABLE-HANDLE my-table-handle)

... /* convert handle to static temp-table, so I can use my-table.field1 instead of my-table-handle:BUFFER-FIELD("field1") */

All Replies

Posted by jmls on 10-Mar-2014 09:36

no, but instead of

my-table-handle:BUFFER-FIELD("field1"):BUFFER-VALUE

you can use the shortcut

my-table-handle::field1

(saves some typing, at least)

julian


On 10 March 2014 14:30, jquerijero
wrote:
> Is there a way to convert a temp-table handle back to the static definition?
> Thread created by jquerijero
>
> I have a handle to a static temp-table that I pass around. Is there a trick
> so that I can convert the handle parameter back to the static temp-table
> definition.
>
> Ex.
>
> DEFINE TEMP-TABLE my-table . . .
>
> PUBLIC SomeMethod(INPUT TABLE-HANDLE my-table-handle)
>
> ... /* convert handle to static temp-table, so I can use my-table.field1
> instead of my-table-handle:BUFFER-FIELD("field1") */
>
> Stop receiving emails on this subject.
>
> Flag this post as spam/abuse.



--
Julian Lyndon-Smith
IT Director,
dot.r
http://www.dotr.com

"The bitterness of poor quality remains long after the sweetness of
low price is forgotten"

Follow dot.r on http://twitter.com/DotRlimited

Posted by James Palmer on 10-Mar-2014 09:37

A small rider to that advice being that you need to be on v10 or later for that shortcut to work IIRC.

Posted by Peter Judge on 10-Mar-2014 09:41

Look at the BIND keyword. You should be able to do something similar to the below with temp-tables.
 
   method protected void BindReceivedDataset( input dataset dsOrder bind):
        /* no body needed. the parameter passing does what we need. */
    end method.
 
    method override protected void ReceiveDataset(input phDataset as handle):
        BindReceivedDataset(dataset-handle phDataset).
    end method.
 
It's not the most elegant syntax, and you can't use it in interfaces, but it works well enough.  Once you've done that dance, you can do a FOR EACH on the temp-tables.
 
-- peter
 
 
[collapse]
From: jquerijero [mailto:bounce-jquerijero@community.progress.com]
Sent: Monday, 10 March, 2014 10:31
To: TU.OE.Development@community.progress.com
Subject: Is there a way to convert a temp-table handle back to the static definition?
 
Thread created by jquerijero

I have a handle to a static temp-table that I pass around. Is there a trick so that I can convert the handle parameter back to the static temp-table definition.

Ex.

DEFINE TEMP-TABLE my-table . . .

PUBLIC SomeMethod(INPUT TABLE-HANDLE my-table-handle)

... /* convert handle to static temp-table, so I can use my-table.field1 instead of my-table-handle:BUFFER-FIELD("field1") */

Stop receiving emails on this subject.

Flag this post as spam/abuse.

[/collapse]

Posted by jmls on 10-Mar-2014 09:41

yup.

On 10 March 2014 14:38, James Palmer
wrote:
> RE: Is there a way to convert a temp-table handle back to the static
> definition?
> Reply by James Palmer
>
> A small rider to that advice being that you need to be on v10 or later for
> that shortcut to work IIRC.
>
> Stop receiving emails on this subject.
>
> Flag this post as spam/abuse.



--
Julian Lyndon-Smith
IT Director,
dot.r
http://www.dotr.com

"The bitterness of poor quality remains long after the sweetness of
low price is forgotten"

Follow dot.r on http://twitter.com/DotRlimited

Posted by Stefan Drissen on 11-Mar-2014 02:22

If you know the definition of what you are receiving you can.

a.p

DEF VAR ht AS HANDLE.
DEF VAR hb AS HANDLE.

CREATE TEMP-TABLE ht.
ht:ADD-NEW-FIELD( "ii", "integer" ).

ht:TEMP-TABLE-PREPARE( "ttdynamic" ).

hb = ht:DEFAULT-BUFFER-HANDLE.

hb:BUFFER-CREATE().
hb::ii = 2014.

RUN b.p (TABLE-HANDLE ht).


b.p

DEFINE TEMP-TABLE tt FIELD ii AS INT.

DEFINE INPUT PARAMETER TABLE FOR tt.

FOR EACH tt:
   MESSAGE tt.ii VIEW-AS ALERT-BOX.
END.


I would assume that this also works with classes.

Posted by jquerijero on 11-Mar-2014 09:39

That's good to know.

Another questions;

Does it work if b.p uses INPUT-OUTPUT parameter?

Does it work if b.p uses INPUT-OUTPUT parameter and is run on the AppServer?

This thread is closed