0
votes

I have a progress 4gl rest webservice. The Create method accepts a dataset from which I extract its underlying temp table

METHOD PUBLIC VOID Createprices(INPUT-OUTPUT DATASET dsprices):
        DEFINE VARIABLE hT AS HANDLE.
        ht = DATASET dsprices:GET-BUFFER-HANDLE(TEMP-TABLE ttprices:NAME).
        ht = ht:DEFAULT-BUFFER-HANDLE.
        PreTransactionValidate(INPUT-OUTPUT TABLE-HANDLE ht).

I then pass the temp-table buffer to another method (pretransactionvalidate) where I compute the values for a couple of fields. The PretransactionValidate method with dummy values being assigned -

METHOD  PUBLIC VOID PreTransactionValidate( INPUT-OUTPUT table-handle ttprices):
FOR EACH ttprices:
ASSIGN    
            ttprices.PricesId  = NEXT-VALUE(SeqPricesId)                
            ttprices.AddedDate = TODAY
            ttprices.AddedTime = TIME.
END. 

Calling the PretransactionValidate method causes my Create Method to fail. If I comment out the call, I can successfully create a record. I'm a Progress newbie and can't find much material on the net, so any help would be worth trying.

Cheers

1
Please provide most details about the error you're receiving ... - Mike Fechner
Hi Mike, I've managed to resolve the errors, but the values that are being assigned in pretransactionvalidate and not being saved when I call : SUPER:CreateData(INPUT-OUTPUT DATASET-HANDLE hDataSet) . in Createprices. However, if I do the following: CREATE ttNewPrices. FOR EACH ttprices EXCLUSIVE-LOCK: BUFFER-COPY ttprices TO ttNewPrice. END. BUFFER-COPY ttNewPrice TO prices. the updated values are being saved. - Ashish Chettri
Bot sure, where that additional temp-table ttNewPrice is from. Next time, I suggest you post more relevant code then :-) - Mike Fechner

1 Answers

1
votes

In your Createprices method, ht is assigned to the handle of a buffer, but your procedure PreTransactionValidate expects a dataset handle.

As both methods are in the same compile unit (class), it's not required to pass the temp-table as a parameter anyway. Temp-tables are (unfortunately) always class-global in the ABL.

If both methods would be in different compile units, you could pass the temp-table directly:

<some_object_reference>:PreTransactionValidate (INPUT-OUTPUT TABLE ttprices).