Description
Write here all tests on database update (new / modify / delete) that cannot be coded with a validation mask.
The type of update can be found in tc_status (N/C/D).
If you find incorrect data, you must write an entry in tFcMessages (using SetMessage) and set the return status of this method to either +1 or -1.
Return status +1 = data will still be accepted.
Return status -1 = data will not be accepted.
This method is run from SetPublicTables, before transferring the received data into the class temp-tables.
Parameters
oiReturnStatus | output | integer | |
Internal usage
unused
program code (program/bfrwcolumngroup.p)
/* Save the original status of tFRWColDet */
empty temp-table tTempFRWColDet.
for each t_sFRWColDet:
create tTempFRWColDet.
buffer-copy t_sFRWColDet to tTempFRWColDet.
if t_sFRWColDet.FRWColDetLeadTrailUnitLabel = ? or t_sFRWColDet.FRWColDetLeadTrailUnitLabel = "":U then assign t_sFRWColDet.FRWColDetLeadTrailUnitLabel = {&FRWCOLDETCURRSIGNP-TRAILING-TR}.
end.
<M-23 run ValidateComponentPre (output viFcReturnSuper (oiReturnStatus)) in BFRWColumnGroup>
if viFcReturnSuper < 0 or viFcReturnSuper > 0 and oiReturnStatus = 0 then assign oiReturnStatus = viFcReturnSuper.
/* ===================================================================================== *
* Dont remove this "strange" code. See more details in ValidateComponentPreResuquence *
* Change sequence to be negative, so there is no collision with existing records in DB *
* ===================================================================================== */
for each t_SFRWColDet WHERE
T_SFRWColDet.tc_Status <> "D":U:
assign t_sFRWColDet.FRWColDetSeq = - t_sFRWColDet.FRWColDetSeq.
end.
assign viLocalReturn = oiReturnStatus
oiReturnStatus = 0.
<ANCESTOR-CODE>
if viLocalReturn < 0 or viLocalReturn > 0 and oiReturnStatus = 0 then assign oiReturnStatus = viLocalReturn.
/* ===================================================================================== *
* Dont remove this "strange" code. See more details in ValidateComponentPreResuquence *
* Restore original requred sequence *
* ===================================================================================== */
for each t_SFRWColDet WHERE
T_SFRWColDet.tc_Status <> "D":U:
assign t_sFRWColDet.FRWColDetSeq = - t_sFRWColDet.FRWColDetSeq.
end.
<M-22 run ValidateComponentPost (output viFcReturnSuper (oiReturnStatus)) in BFRWColumnGroup>
if viFcReturnSuper < 0 or viFcReturnSuper > 0 and oiReturnStatus = 0 then assign oiReturnStatus = viFcReturnSuper.
/* Roll back t_sFRWColDet table */
if oiReturnStatus < 0 then
do:
for each t_sFRWColDet:
/* Recover status of FRWColDet which is not new. */
if t_sFRWColDet.tc_Status <> "N":U then
do:
find first tTempFRWColDet where tTempFRWColDet.tc_Rowid = t_sFRWColDet.tc_Rowid no-error.
if available tTempFRWColDet then
assign t_sFRWColDet.tc_Status = tTempFRWColDet.tc_Status.
find first tFRWColDet where tFRWColDet.tc_Rowid = t_sFRWColDet.tc_Rowid no-error.
if available tFRWColDet then
assign tFRWColDet.tc_Status = "":U.
end.
/* Handle new row */
else do:
/* If ColDet is added from UI, then skip. */
find first tTempFRWColDet where tTempFRWColDet.FRWColDet_ID = t_sFRWColDet.FRWColDet_ID no-error.
if available tTempFRWColDet and t_sFRWColDet.FRWAnCode_ID = 0 then
next.
/* Delete FRWColDet if it is added in ValidateComponentPreResquence. */
find first tFRWColDet where tFRWColDet.FRWColDet_ID = t_sFRWColDet.FRWColDet_ID no-error.
if available tFRWColDet then
delete tFRWColDet.
delete t_sFRWColDet.
end.
end.
end.