project QadFinancials > class BFRWAnalysisCode > method ValidateComponentPreDelete

Description

Validation method to check if records can be deleted.


Parameters


oiReturnStatusoutputintegerReturn status of the method.


Internal usage


QadFinancials
method BFRWAnalysisCode.ValidateComponentPre


program code (program1/bfrwanalysiscode.p)

assign oiReturnStatus = -98.

for each t_sFRWAnCode where 
         t_sFRWAnCode.tc_Status = 'D':U:

    /* =================================================================== */
    /* Check if the analysis code is being used by a report tree node.     */
    /* =================================================================== */
    <Q-28 run ReportTreeByAnalysisCodeId (all) (Read) (NoCache)
       (input t_sFRWAnCode.FRWAnCode_ID, (AnalysisCodeId)
        output dataset tqReportTreeByAnalysisCodeId) in BReportTree>

    for first tqReportTreeByAnalysisCodeId where
        tqReportTreeByAnalysisCodeId.tiFRWAnCode_ID = t_sFRWAnCode.FRWAnCode_ID     
    no-lock:
        assign oiReturnStatus = -1
               vcMessage      = trim(#T-64'The analysis code cannot be deleted: It is being used by report tree node &1':255(901197156)T-64#)
               vcMessage      = substitute(vcMessage,tqReportTreeByAnalysisCodeId.tcFRWTreeNodeParentCode).
        <M-33 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-305263':U (icFcMsgNumber), 
            input  '':U (icFcExplanation), 
            input  '':U (icFcIdentification), 
            input  '':U (icFcContext), 
            output viFcReturnSuper (oiReturnStatus)) in BFRWAnalysisCode>
        return.
    end.  /* for first tqReportTreeByAnalysisCodeId where ...           */

    /* =================================================================== */
    /* Check if the analysis code is being used by a report master record. */
    /* =================================================================== */
    <Q-52 run FRWReportMasterByAnCodeID (all) (Read) (NoCache)
       (input t_sFRWAnCode.FRWAnCode_ID, (AnalysisCodeID)
        output dataset tqFRWReportMasterByAnCodeID) in BFRWReportMaster>
        
    for first tqFRWReportMasterByAnCodeID where
              tqFRWReportMasterByAnCodeID.tiFRWAnCode_ID = t_sFRWAnCode.FRWAnCode_ID
    no-lock:
        assign oiReturnStatus = -1
               vcMessage      = trim(#T-50'The analysis code cannot be deleted: It is being used by report master &1':255(875607113)T-50#)
               vcMessage      = substitute(vcMessage,tqFRWReportMasterByAnCodeID.tcFRWRepMstrCode).
        <M-89 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-95851':U (icFcMsgNumber), 
            input  '':U (icFcExplanation), 
            input  '':U (icFcIdentification), 
            input  '':U (icFcContext), 
            output viFcReturnSuper (oiReturnStatus)) in BFRWAnalysisCode>
        return.
    end.  /* for first tqFRWReportMasterByAnCodeID where ...            */   
    
    /* =================================================================== */
    /* Check if the analysis code is being used by a column group.         */
    /* =================================================================== */
    <Q-41 run FRWColDetByFRWAnCodeId (all) (Read) (NoCache)
       (input t_sFRWAnCode.FRWAnCode_ID, (AnalysisCodeID)
        output dataset tqFRWColDetByFRWAnCodeId) in BFRWAnalysisCode>
        
    for each tqFRWColDetByFRWAnCodeId where
             tqFRWColDetByFRWAnCodeId.tiFRWAnCode_ID = t_sFRWAnCode.FRWAnCode_ID
    no-lock:
        assign oiReturnStatus = -1
               vcMessage      = trim(#T-35'The analysis code cannot be deleted: It is being used by the column group &1, sequence &2':255(444066232)T-35#)
               vcMessage      = substitute(vcMessage,tqFRWColDetByFRWAnCodeId.tcFRWColCode,tqFRWColDetByFRWAnCodeId.tiFRWColDetSeq).
        <M-86 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-143897':U (icFcMsgNumber), 
            input  '':U (icFcExplanation), 
            input  '':U (icFcIdentification), 
            input  '':U (icFcContext), 
            output viFcReturnSuper (oiReturnStatus)) in BFRWAnalysisCode>
        return.
    end.  /* for each tqFRWColDetByFRWAnCodeId where ...                  */
    /* =================================================================== */
    /* Check if the analysis code is being used by budget.                 */
    /* =================================================================== */
    <Q-69 run BudgetByFRWChartId (all) (Read) (NoCache)
       (input t_sFRWAnCode.FRWChart_ID, (FRWChartId)
        output dataset tqBudgetByFRWChartId) in BBudget>
        
     for each tqBudgetByFRWChartId no-lock:                         
          <Q-75 run BudgetWBSByBudgetId2 (all) (Read) (NoCache)
             (input tqBudgetByFRWChartId.tiBudget_ID, (BudgetId)
              output dataset tqBudgetWBSByBudgetId2) in BBudget>
               
          for each tqBudgetWBSByBudgetId2 no-lock:
              assign viAnalysisCodeNum = num-entries(tqBudgetWBSByBudgetId2.tcBudgetWBSFDSList).
              Repeat while viAnalysisCodeNum > 0 :
                  assign vcAnalysisCode = entry(viAnalysisCodeNum,tqBudgetWBSByBudgetId2.tcBudgetWBSFDSList,',').
                  viAnalysisCodeNum = viAnalysisCodeNum - 1 .
                  if vcAnalysisCode = t_sFRWAnCode.FRWAnCodeCode then 
                  do:                    
                     assign  vcMessage = trim(#T-82'The analysis code cannot be deleted: It is being used by the budget':255(690354936)T-82#)
                             oiReturnStatus = -1. 
                     <M-81 run SetMessage
                        (input  vcMessage (icMessage), 
                         input  '':U (icArguments), 
                         input  '':U (icFieldName), 
                         input  '':U (icFieldValue), 
                         input  'E' (icType), 
                         input  3 (iiSeverity), 
                         input  '':U (icRowid), 
                         input  'qadfin-390195':U (icFcMsgNumber), 
                         input  '':U (icFcExplanation), 
                         input  '':U (icFcIdentification), 
                         input  '':U (icFcContext), 
                         output viFcReturnSuper (oiReturnStatus)) in BFRWAnalysisCode>
                         return. 
                   end. /*if vcAnalysisCode = t_sFRWAnCode.FRWAnCodeCode*/
                end. /*Repeat while viAnalysisCodeNum > 0 */
             end. /*for each tqBudgetWBSByBudgetId2*/
        end.  /* for each tqBudgetByFRWChartId where */   
end.      /* for each t_sFRWAnCode where t_sFRWAnCode.tc_Status = 'D':U */

if oiReturnStatus = -98
then assign oiReturnStatus = 0.