project QadFinancials > class BMfgAddressListDetail > 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/bmfgaddresslistdetail.p)

/* Ancestor code is commented because of the performance */
/*
<ANCESTOR-CODE>
*/

for each t_sls_mstr where
         t_sls_mstr.tc_Status = "N" or
         t_sls_mstr.tc_Status = "C":

    /* Check, if the record is unique */
    if t_sls_mstr.tc_Status = "N"
    then do:
        <Q-13 assign vlFcQueryRecordsAvailable = AddressListDetailByDomainCode (NoCache)
           (input t_sls_mstr.ls_addr, (AddressCode)
            input t_sls_mstr.ls_domain, (domain)
            input t_sls_mstr.ls_type, (AddressType)) in BMfgAddressListDetail >
        if vlFcQueryRecordsAvailable <> false
        then do:
            assign vcMessage =  #T-89'Address list detail record with code &1 in the Domain &2 already exists.':255(412588623)T-89#
                   vcMessage = substitute(vcMessage, t_sls_mstr.ls_addr, t_sls_mstr.ls_domain).
            <M-52 run SetMessage
               (input  vcMessage (icMessage), 
                input  '':U (icArguments), 
                input  'ls_mstr.ls_addr':U (icFieldName), 
                input  t_sls_mstr.ls_addr (icFieldValue), 
                input  'E':U (icType), 
                input  3 (iiSeverity), 
                input  t_sls_mstr.tc_Rowid (icRowid), 
                input  'qadfin-609146':U (icFcMsgNumber), 
                input  '':U (icFcExplanation), 
                input  '':U (icFcIdentification), 
                input  '':U (icFcContext), 
                output viFcReturnSuper (oiReturnStatus)) in BMfgAddressListDetail>
            assign oiReturnStatus = -1.
        end.
    end.
end.