project BLF > class Database Component > method ValidateComponent

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


oiReturnStatusoutputinteger


Internal usage


BLF
method database.ValidateBC
method database.ValidateUI


program code (program1/database.p)

/* Field Security validations */
if vlFieldSecurityActive     and
   vlFieldSecurityActiveOnBC and
   vcActivityCode <> ""
then do:
    <M-7 run ValidateFieldSecurity (output viFcReturnSuper (oiReturnStatus)) in database>
    if viFcReturnSuper <> 0
    then oiReturnStatus = viFcReturnSuper.
    if viFcReturnSuper < 0
    then return.   /* no permission = stop validating */
end.

<M-6 run ValidateActivityCode (output viFcReturnSuper (oiReturnStatus)) in database>
if viFcReturnSuper <> 0
then oiReturnStatus = viFcReturnSuper.
if viFcReturnSuper < 0
then return.   /* no permission = stop validating */

<I-2 {bFcRun
     &PARAMETERS           = "output viFcReturnSuper"
     &PROCEDURE            = "gipr_SetRelatedBusinessFields"}>
if viFcReturnSuper <> 0
and oiReturnStatus >= 0
then assign oiReturnStatus = viFcReturnSuper.

if not vcFcComponentName begins "BCustom["
then do:
    <I-1 {bFcRun
         &PARAMETERS           = "output viFcReturnSuper"
         &PROCEDURE            = "gipr_ValidateTables"}>

    if viFcReturnSuper <> 0
    and oiReturnStatus >= 0
    then assign oiReturnStatus = viFcReturnSuper.
end.

<M-5 run ValidateCustomFields (output viFcReturnSuper (oiReturnStatus)) in database>
if viFcReturnSuper <> 0
and oiReturnStatus >= 0
then assign oiReturnStatus = viFcReturnSuper.