project BLF > class BSODCategory > 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


unused


program code (program/bsodcategory.p)

<ANCESTOR-CODE>

/* ================================================================= */
/* Validate restricted delete on relations                           */
/* SODCategory1inSODExclusion + SODCategory2inSODExclusion.          */
/* (BLF-2461)                                                        */
/* ================================================================= */
for each t_sSODCategory where t_sSODCategory.tc_Status = "D":
    
    if can-find (first SODExclusion where SODExclusion.SODCategory1_ID = t_sSODCategory.SODCategory_ID)
    or can-find (first SODExclusion where SODExclusion.SODCategory2_ID = t_sSODCategory.SODCategory_ID)
    then do:
        <M-7 run SetMessage
           (input  #T-45'Cannot delete SOD Category '$1'. You must first delete all exclusions for this SOD Category in the SOD Matrix.':255(337030121)T-45# (icMessage), 
            input  t_sSODCategory.SODCategoryCode (icArguments), 
            input  'tSODCategory.SODCategoryCode' (icFieldName), 
            input  t_sSODCategory.SODCategoryCode (icFieldValue), 
            input  'E' (icType), 
            input  3 (iiSeverity), 
            input  t_sSODCategory.tc_Rowid (icRowid), 
            input  'blf-135106':U (icFcMsgNumber), 
            input  '' (icFcExplanation), 
            input  '' (icFcIdentification), 
            input  '' (icFcContext), 
            output viFcReturnSuper (oiReturnStatus)) in BSODCategory>
        oiReturnStatus = -1.
    end.
end.