izInputData | input | dataset-handle | class dataset |
icActivityCode | input | character | Activity code (CREATE or MODIFY or DELETE) determines the kind of update. Value of tc_Status in the input data is ignored. When empty, CREATE or UPDATE is assumed, depending on whether the input data already exists in the application database. |
oiReturnStatus | output | integer | Return status of the method. |
assign vcActivityCode = icActivityCode. /* ================================================================= */ /* Clear the I and O buffers in the object dataset by calling ClearData */ /* ================================================================= */ <M-7 run ClearData (output viFcReturnSuper (oiReturnStatus)) in database> if viFcReturnSuper <> 0 then oiReturnStatus = viFcReturnSuper. if viFcReturnSuper < 0 then return. /* ================================================================= */ /* Transfer input data to the class temp tables t_s*** */ /* ================================================================= */ run gipr_ClearSTables in {&TARGETPROCEDURE} no-error. <M-1 run DataDescription (input '' (icRowids), input '' (icPkey), input '' (icObjectIds), input yes (ilAllTables), output viFcReturnSuper (oiReturnStatus)) in database> if viFcReturnSuper <> 0 then oiReturnStatus = viFcReturnSuper. if viFcReturnSuper < 0 then return. for each tFcDynRel on error undo, throw: vhLocalBuffer = tFcDynRel.thFcSBuffer. vhInputBuffer = ?. vhInputBuffer = izInputData:get-buffer-handle("t":U + tFcDynRel.tcFcTo) no-error. if vhInputBuffer = ? then do: assign oiReturnStatus = -3. <M-6 run SetMessage (input 'Table t$1 not found in input data.':U (icMessage), input tFcDynRel.tcFcTo (icArguments), input '' (icFieldName), input '' (icFieldValue), input 'S':U (icType), input 1 (iiSeverity), input '' (icRowid), input 'BLF-306':U (icFcMsgNumber), input '' (icFcExplanation), input '' (icFcIdentification), input '' (icFcContext), output viFcReturnSuper (oiReturnStatus)) in database> return. end. create query vhInputQuery in widget-pool "non-persistent". vhInputQuery:forward-only = yes. vhInputQuery:set-buffers(vhInputBuffer). vhInputQuery:query-prepare ("for each t":U + tFcDynRel.tcFcTo). vhInputQuery:query-open(). vhInputQuery:get-first(). do while not vhInputQuery:query-off-end: vhLocalBuffer:buffer-create(). vhLocalBuffer:buffer-copy(vhInputBuffer). vhLocalBuffer:buffer-release(). vhInputQuery:get-next(). end. vhInputQuery:query-close(). delete object vhInputQuery. end. /* ================================================================= */ /* Update data */ /* ================================================================= */ <M-5 run MaintainByDataset (input {&DAEMONACTION-SAVE} (icAction), output vpar1 (opPrimaryKey), output vpar2 (opRowid), output viFcCount4 (oiDraftInstance), output viFcReturnSuper (oiReturnStatus)) in database> if viFcReturnSuper <> 0 then oiReturnStatus = viFcReturnSuper. if viFcReturnSuper < 0 then return.