I'm trying to create a single proxy query to our appserver
, which uses the following parameters:
editTest.p
DEFINE TEMP-TABLE TT_Test NO-UNDO
BEFORE-TABLE TT_TestBefore
FIELD fieldOne LIKE MyDBTable.FieldOne
FIELD fieldTwo LIKE MyDBTable.FieldTwo
FIELD fieldThree LIKE MyDBTable.FieldThree
.
DEFINE DATASET dsTest FOR TT_Test.
/* Parameters */
DEF INPUT-OUTPUT PARAM DATASET FOR dsTest.
The idea is that the program would call this procedure in 2 different ways:
- with passed dataset parameter: read passed dataset and update db according to it's changes
- without passed dataset parameter/unknown/unset: fill
TT_Test
and return dataset to client for editing
Is there any way to create a proxy like this? Easy solution would be to separate the get
and insert,modify,delete
to 2 own proxy files, so the client would always first get the dataset and then pass it for for the second one. However, I'd like to implement this functionality into this one file.
The key is to use the datasets, so the changes made to the data can be updated almost automatically.
Instead of using the dataset itself as the parameter, use a dataset handle. You can then make it null for your 2nd condition. Adding on to your example, procedure testProc will display a message "yes" when the dataset is passed in via the handle, and "no" when null is passed in.