project BLF > class BReportTranslation > 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/breporttranslation.p)

/*
 * BLF-4417
 * Move assignment of reportbusactivity_id from after the ancestor-code to before the ancestor-code,
 * as ValCodeUnique is run from ancestor-code and needs this ID.
 */

/* Lookup activity_id */
for each t_sReportTranslation where
         t_sReportTranslation.tc_Status = "N":U or
         t_sReportTranslation.tc_Status = "C":U :

    if t_sReportTranslation.tcBusActivityCode = ""
    or t_sReportTranslation.tcBusActivityCode = ?
    then assign t_sReportTranslation.ReportBusActivity_ID = 0.
    else if t_sReportTranslation.tcBusComponentCode = ""
         or t_sReportTranslation.tcBusComponentCode = ?
    then do:
        <M-1 run SetMessage
           (input  #T-6'You must enter this field.':255(72)T-6# (icMessage), 
            input  '' (icArguments), 
            input  't_sReportTranslation.tcBusComponentCode':U (icFieldName), 
            input  '' (icFieldValue), 
            input  'E':U (icType), 
            input  3 (iiSeverity), 
            input  t_sReportTranslation.tc_Rowid (icRowid), 
            input  'BLF-151':U (icFcMsgNumber), 
            input  '' (icFcExplanation), 
            input  '' (icFcIdentification), 
            input  '' (icFcContext), 
            output viFcReturnSuper (oiReturnStatus)) in BReportTranslation>
        assign oiReturnStatus = -1.
    end.
    else do:
        <Q-2 run BusActivityPrim (all)  (Read)  (NoCache)  (input 0, (BusActivityID) 
                          input t_sReportTranslation.tcBusActivityCode, (BusActivityCode) 
                          input t_sReportTranslation.tcBusComponentCode, (BusComponentCode)
                          output dataset tqBusActivityPrim) in BBusinessComponent >
        find first tqBusActivityPrim no-error.
        if available tqBusActivityPrim
        then assign t_sReportTranslation.ReportBusActivity_ID = tqBusActivityPrim.tiBusActivity_ID.
        else do:
            <M-3 run SetMessage
               (input  #T-5'This value was not found.':255(5099)T-5# (icMessage), 
                input  '' (icArguments), 
                input  't_sReportTranslation.tcBusActivityCode':U (icFieldName), 
                input  t_sReportTranslation.tcBusActivityCode (icFieldValue), 
                input  'E':U (icType), 
                input  3 (iiSeverity), 
                input  t_sReportTranslation.tc_Rowid (icRowid), 
                input  'BLF-152':U (icFcMsgNumber), 
                input  '' (icFcExplanation), 
                input  '' (icFcIdentification), 
                input  '' (icFcContext), 
                output viFcReturnSuper (oiReturnStatus)) in BReportTranslation>
            assign oiReturnStatus = -1.
        end.
    end.
end.

<ANCESTOR-CODE>