Pass input-output temp table handle with no data to use appe

Posted by nborshukov on 09-Nov-2016 02:54

Hello!

OpenEdge 11.5.1

Application model - Client and AppServer.

On client side i have procedure with dynamic temp-table defined. I want to fill temp-table in batches, using AppServer procedure. AppServer procedure does NOT know temp-table structure. Fields description is sent to AppServer procedure as parameter.

Server side procedure parameters:
define input parameter field-description as character no-undo.
define input-output parameter table-handle tt-h by-value.

Client side first call (temp-table is empty):
run get-data.p on hAppSrv (input <field-description-var>,input-output table-handle tt-h).

Client side second, third and so on call (temp-table is NOT empty):
run get-data.p on hAppSrv (input <field-description-var>,input-output table-handle tt-h append).

APPEND option forces all returned records to be added to already existing records in temp-table on client side, which causes duplicated records. 

  Can I specify in subsequent calls, client procedure NOT to send to AppServer procedure existing records?  

Posted by Frank Meulblok on 22-Nov-2016 03:31

"Can I specify in subsequent calls, client procedure NOT to send to AppServer procedure existing records?"

Not directly, no.

Alternative approaches:

1. Avoid passing the table back in as input. In other words, change the procedure to use an OUTPUT TABLE-HANDLE parameter.

This is assuming the server-side procedure knows how to construct the correct schema from the fields description.

2. To fetch new batch, clone the schema on client side to new dynamic temp-table (use CREATE-LIKE method for easy cloning). Pass the new, empty table with correct schema to the appserver, let client merge back the data into the main table.

3. Instead of cloning the temp-table object, save overhead and serialize schema using write-xmlschema. Input that to appserver, appserver can that to reconstruct schema and pass table back as output only.

All Replies

Posted by nborshukov on 22-Nov-2016 01:03

Nobody knows?

"No, you can't" is sufficient.

:-)

Posted by Frank Meulblok on 22-Nov-2016 03:31

"Can I specify in subsequent calls, client procedure NOT to send to AppServer procedure existing records?"

Not directly, no.

Alternative approaches:

1. Avoid passing the table back in as input. In other words, change the procedure to use an OUTPUT TABLE-HANDLE parameter.

This is assuming the server-side procedure knows how to construct the correct schema from the fields description.

2. To fetch new batch, clone the schema on client side to new dynamic temp-table (use CREATE-LIKE method for easy cloning). Pass the new, empty table with correct schema to the appserver, let client merge back the data into the main table.

3. Instead of cloning the temp-table object, save overhead and serialize schema using write-xmlschema. Input that to appserver, appserver can that to reconstruct schema and pass table back as output only.

Posted by nborshukov on 22-Nov-2016 04:58

Thank you Frank! Appreciate your help.

This thread is closed