project QadFinancials > class BFRWTreeView > 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/bfrwtreeview.p)

<M-59 run ValidationComponentFRWTreeViewCode  (output viFcReturnSuper (oiReturnStatus)) in BFRWTreeView>
    if viFcReturnSuper < 0 or viFcReturnSuper > 0 and oiReturnStatus = 0 then assign oiReturnStatus = viFcReturnSuper.
    if oiReturnStatus < 0 then return.

<ANCESTOR-CODE>


    
    
    /* ================================================================= */
    /*   validate if the Period/Year belong to the cube code"s Period/Year */
    /* ================================================================= */
    
for each t_sFRWTreeView where 
         t_sFRWTreeView.tc_status <> "D":U :
    assign vcMessage = "":u.
    <Q-67 run FRWCubePeriodByFRWCubeCode (all) (Read) (NoCache)
       (input t_sFRWTreeView.tcFRWCubeCode, (CubeCode)
        output dataset tqFRWCubePeriodByFRWCubeCode) in BFRWCube>

        if not can-find(first tqFRWCubePeriodByFRWCubeCode where 
                              tqFRWCubePeriodByFRWCubeCode.tiFRWCubePeriodReportYear = t_sFRWTreeView.FRWTreeViewReportYearFrom) or
           not can-find(first tqFRWCubePeriodByFRWCubeCode where 
                              tqFRWCubePeriodByFRWCubeCode.tiFRWCubePeriodReportYear = t_sFRWTreeView.FRWTreeViewReportYearTo) then 
        do:
            assign vcMessage      = trim(#T-92'The report year specified must be within the cube report year range.':80(227409867)T-92#)       
                   oiReturnStatus = -1.  
            <M-53 run SetMessage
               (input  vcMessage (icMessage), 
                input  '':U (icArguments), 
                input  '':U (icFieldName), 
                input  '':U (icFieldValue), 
                input  'E':U (icType), 
                input  3 (iiSeverity), 
                input  '':U (icRowid), 
                input  'qadfin-659814':U (icFcMsgNumber), 
                input  '' (icFcExplanation), 
                input  '' (icFcIdentification), 
                input  '' (icFcContext), 
                output viFcReturnSuper (oiReturnStatus)) in BFRWTreeView>
                leave.
        end. 

        if not can-find(first tqFRWCubePeriodByFRWCubeCode where 
                               tqFRWCubePeriodByFRWCubeCode.tiFRWCubePeriodReportPerInt = t_sFRWTreeView.FRWTreeViewReportPeriodFrom and
                               tqFRWCubePeriodByFRWCubeCode.tiFRWCubePeriodReportYear   = t_sFRWTreeView.FRWTreeViewReportYearFrom) or
           not can-find(first tqFRWCubePeriodByFRWCubeCode where
                              tqFRWCubePeriodByFRWCubeCode.tiFRWCubePeriodReportPerInt = t_sFRWTreeView.FRWTreeViewReportPeriodTo and
                              tqFRWCubePeriodByFRWCubeCode.tiFRWCubePeriodReportYear   = t_sFRWTreeView.FRWTreeViewReportYearTo) then
        do:
            assign vcMessage      = trim(#T-74'The report period specified must be within the cube report period range.':80(951805252)T-74#)       
                   oiReturnStatus = -1.  
                  
            <M-69 run SetMessage
               (input  vcMessage (icMessage), 
                input  '':U (icArguments), 
                input  '':U (icFieldName), 
                input  '':U (icFieldValue), 
                input  'E':U (icType), 
                input  3 (iiSeverity), 
                input  '':U (icRowid), 
                input  'qadfin-544227':U (icFcMsgNumber), 
                input  '' (icFcExplanation), 
                input  '' (icFcIdentification), 
                input  '' (icFcContext), 
                output viFcReturnSuper (oiReturnStatus)) in BFRWTreeView>
                  leave.
        end. 
 
    if t_sFRWTreeView.FRWTreeViewReportYearFrom > t_sFRWTreeView.FRWTreeViewReportYearTo then
    do:
        assign vcMessage      = trim(#T-38'The year you specify in the Report Year From field cannot be later than the year specified in the Report Year To field.':200(779976404)T-38#)       
               oiReturnStatus = -1.  
         
        <M-34 run SetMessage
           (input  vcMessage (icMessage), 
            input  '':U (icArguments), 
            input  '':U (icFieldName), 
            input  '':U (icFieldValue), 
            input  'E':U (icType), 
            input  3 (iiSeverity), 
            input  '':U (icRowid), 
            input  'qadfin-511912':U (icFcMsgNumber), 
            input  '' (icFcExplanation), 
            input  '' (icFcIdentification), 
            input  '' (icFcContext), 
            output viFcReturnSuper (oiReturnStatus)) in BFRWTreeView>    
                    
    end. 
       
    if t_sFRWTreeView.FRWTreeViewReportYearFrom = t_sFRWTreeView.FRWTreeViewReportYearTo and 
       t_sFRWTreeView.FRWTreeViewReportPeriodFrom > t_sFRWTreeView.FRWTreeViewReportPeriodTo then
    do:
        assign vcMessage      = trim(#T-97'The period you specify in the Report Period From field cannot be later than the period specified in the Report Period To field in the same year.':200(329404358)T-97#)       
               oiReturnStatus = -1.  

        <M-91 run SetMessage
           (input  vcMessage (icMessage), 
            input  '':U (icArguments), 
            input  '':U (icFieldName), 
            input  '':U (icFieldValue), 
            input  'E':U (icType), 
            input  3 (iiSeverity), 
            input  '':U (icRowid), 
            input  'qadfin-491547':U (icFcMsgNumber), 
            input  '' (icFcExplanation), 
            input  '' (icFcIdentification), 
            input  '' (icFcContext), 
            output viFcReturnSuper (oiReturnStatus)) in BFRWTreeView>    
                    
       end. 
    /*if t_sFRWTreeView.FRWTreeViewReportPeriodFrom < 1 or t_sFRWTreeView.FRWTreeViewReportPeriodFrom > 12 
          or t_sFRWTreeView.FRWTreeViewReportPeriodTo < 1 or t_sFRWTreeView.FRWTreeViewReportPeriodTo > 12 then 
      do:
         assign vcMessage      = trim(#T-95'Report Period must range from 1 to 12':40(872279665)T-95#)       
                  oiReturnStatus = -1.  

                <M-71 run SetMessage
                   (input  vcMessage (icMessage), 
                    input  '':U (icArguments), 
                    input  '':U (icFieldName), 
                    input  '':U (icFieldValue), 
                    input  'E':U (icType), 
                    input  3 (iiSeverity), 
                    input  '':U (icRowid), 
                    input  'qadfin-923228':U (icFcMsgNumber), 
                    input  '' (icFcExplanation), 
                    input  '' (icFcIdentification), 
                    input  '' (icFcContext), 
                    output viFcReturnSuper (oiReturnStatus)) in BFRWTreeView>    
                    
      end.  */    
end. /*for each t_sFRWTreeView */