project QadFinancials > class BFRWTreeView > method ValidationComponentFRWTreeViewCode

validation procedure

Description

This method is used validate if the Report tree code ,Cube Code and Filter Analysis Code is correct.


Parameters


oiReturnStatusoutputintegerReturn status of the method.


Internal usage


QadFinancials
method BFRWTreeView.ValidateComponent


program code (program1/bfrwtreeview.p)

for each t_sFRWTreeView where 
         t_sFRWTreeView.tc_status <> "D":U :
    assign vcMessage = "":u.
     
    /* ================================================================= */
    /*  check if the Report tree code is exist.                          */
    /* ================================================================= */

    <Q-56 run SelectReportTreeForTreeNode (all) (Read) (NoCache)  (output dataset tqSelectReportTreeForTreeNode) in BReportTree>
    find first tqSelectReportTreeForTreeNode where tqSelectReportTreeForTreeNode.tcFRWTreeNodeCode = t_sFRWTreeView.tcFRWTreeNodeCode no-lock no-error.
    if not available tqSelectReportTreeForTreeNode then 
    do:
        assign vcMessage = trim(#T-12'The Report tree Code specified does not exist.':255(115420504)T-12#)        
               oiReturnStatus = -1.  
         
       <M-73 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-484254':U (icFcMsgNumber), 
           input  '' (icFcExplanation), 
           input  '' (icFcIdentification), 
           input  '' (icFcContext), 
           output viFcReturnSuper (oiReturnStatus)) in BFRWTreeView>  
                    
      end.
      else do:
          assign  t_sFRWTreeView.FRWTreeNode_ID = tqSelectReportTreeForTreeNode.tiFRWTreeNode_ID. 
               
          /* ================================================================= */
          /*    check if Cube Code is exist                                    */
          /* ================================================================= */
            
          <Q-95 run FRWCubeByFRWCubeCode (all) (Read) (NoCache)
             (input t_sFRWTreeView.tcFRWCubeCode, (FRWCubeCode)
              output dataset tqFRWCubeByFRWCubeCode) in BFRWCube>
          find first tqFRWCubeByFRWCubeCode no-lock no-error.
          if not available tqFRWCubeByFRWCubeCode then 
          do:
              assign vcMessage      = trim(#T-49'The Cube Code specified does not exist.':40(498779839)T-49#) 
                     oiReturnStatus = -1.  
                         
              <M-76 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-51655':U (icFcMsgNumber), 
                  input  '' (icFcExplanation), 
                  input  '' (icFcIdentification), 
                  input  '' (icFcContext), 
                  output viFcReturnSuper (oiReturnStatus)) in BFRWTreeView>  
              
         end.              
         else do:
             assign t_sFRWTreeView.FRWCube_ID = tqFRWCubeByFRWCubeCode.tiFRWCube_ID.
             <Q-90 run ReportTreeByReportChartID (all) (Read) (NoCache)
                (input tqFRWCubeByFRWCubeCode.tiFRWChart_ID, (FRWTreeNodeFRWChartID)
                 input ?, (FRWTreeNodeId)
                 output dataset tqReportTreeByReportChartId) in BReportTree>
             find first tqReportTreeByReportChartId where tqReportTreeByReportChartId.tcFRWTreeNodeCode = t_sFRWTreeView.tcFRWTreeNodeCode no-lock no-error.                     
             if available tqReportTreeByReportChartId then 
             do:
                 assign t_sFRWTreeView.FRWTreeNode_ID = tqReportTreeByReportChartId.tiFRWTreeNode_ID.
             end.
             else do:
                 assign vcMessage      = trim(#T-58'The Report Tree and Cube code must belong to the same Report Chart.':255(348546401)T-58#)
                        oiReturnStatus = -1.
                 <M-57 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-588358':U (icFcMsgNumber), 
                     input  '' (icFcExplanation), 
                     input  '' (icFcIdentification), 
                     input  '' (icFcContext), 
                     output viFcReturnSuper (oiReturnStatus)) in BFRWTreeView> 
            end.
              
            if t_sFRWTreeView.tcFRWAnCodeCode = '' then assign t_sFRWTreeView.FRWAnCode_ID = 0.
            if t_sFRWTreeView.tcFRWAnCodeCode <> '' then 
            do:

                <Q-1 run FRWAnCodeByFRWAnCode (all) (Read) (NoCache)
                   (input t_sFRWTreeView.tcFRWAnCodeCode, (FRWAnCode)
                    input ?, (FRWAnCodeId)
                    output dataset tqFRWAnCodeByFRWAnCode) in BFRWAnalysisCode>
                find first tqFRWAnCodeByFRWAnCode no-lock no-error.
                if available tqFRWAnCodeByFRWAnCode then  
                do:
                    if tqFRWAnCodeByFRWAnCode.tcFRWAnCodeAnalyseType = "A" then
                    do:
                       <Q-84 run FRWAnCodeByFRWChartCode (all) (Read) (NoCache)
                          (input tqFRWCubeByFRWCubeCode.tcFRWCubeFRWChartCode, (FRWAnCodeFRWChartCode)
                           output dataset tqFRWAnCodeByFRWChartCode) in BFRWAnalysisCode>
                       find first tqFRWAnCodeByFRWChartCode where tqFRWAnCodeByFRWChartCode.tcFRWAncodeCode = t_sFRWTreeView.tcFRWAnCodeCode no-lock no-error.
                       if available tqFRWAnCodeByFRWChartCode then
                           do:
                              assign t_sFRWTreeView.FRWAnCode_ID = tqFRWAnCodeByFRWChartCode.tiFRWAnCode_ID.                          
                           end.
                       else do:
                           assign vcMessage      = trim(#T-65'The Report Tree, Cube and Filter Analysis code must belong to the same Report Chart.':255(218994383)T-65#)
                                  oiReturnStatus = -1.
                           <M-7 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-672785':U (icFcMsgNumber), 
                               input  '' (icFcExplanation), 
                               input  '' (icFcIdentification), 
                               input  '' (icFcContext), 
                               output viFcReturnSuper (oiReturnStatus)) in BFRWTreeView> 
                       end.
                   end.
                   
                   if tqFRWAnCodeByFRWAnCode.tcFRWAnCodeAnalyseType <> "A" then 
                   do :
                       assign vcMessage      = trim(#T-48'Only analysis code with type 'A' can be used for filter analysis code':80(20700686)T-48#)
                           oiReturnStatus = -1.
                           
                       <M-94 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-621522':U (icFcMsgNumber), 
                           input  '' (icFcExplanation), 
                           input  '' (icFcIdentification), 
                           input  '' (icFcContext), 
                           output viFcReturnSuper (oiReturnStatus)) in BFRWTreeView>
                  end. 
                end.
                else do:
                    assign vcMessage      = trim(#T-31'The Analysis code specified does not exist.':80(16230353)T-31#)
                           oiReturnStatus = -1.
                           
                    <M-41 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-156488':U (icFcMsgNumber), 
                        input  '' (icFcExplanation), 
                        input  '' (icFcIdentification), 
                        input  '' (icFcContext), 
                        output viFcReturnSuper (oiReturnStatus)) in BFRWTreeView>
                end. /*if available tqFRWAnCodePrim*/
              end. /*if t_sFRWTreeView.tcFRWAnCodeCode <> ''*/  
          end. /*if not available tqFRWCubeByFRWCubeCode*/
      end. 
     /* ================================================================= */
    /*   if the FRWTreeView already exist                                 */
    /* ================================================================= */

    <Q-61 run FRWTreeViewByApiFields (all) (Read) (NoCache)
       (input ?, (UsrId)
        input t_sFRWTreeView.FRWAnCode_ID, (FRWAnCodeId)
        input t_sFRWTreeView.FRWCube_ID, (FRWCubeId)
        input t_sFRWTreeView.FRWTreeViewAmountsIn, (FRWTreeViewAmountIn)
        input t_sFRWTreeView.FRWTreeViewReportPeriodFrom, (FRWTreeViewReportPeriodFrom)
        input t_sFRWTreeView.FRWTreeViewReportPeriodTo, (FRWTreeViewReportPeriodTo)
        input t_sFRWTreeView.FRWTreeViewReportYearFrom, (FRWTreeViewReportYearFrom)
        input t_sFRWTreeView.FRWTreeViewReportYearTo, (FRWTreeViewReportYearTo)
        input t_sFRWTreeView.FRWTreeNode_ID, (FRWTreeNodeId)
        output dataset tqFRWTreeViewByApiFields) in BFRWTreeView>
    find first tqFRWTreeViewByApiFields where tqFRWTreeViewByApiFields.tiFRWAnCode_ID = t_sFRWTreeView.FRWAnCode_ID no-lock no-error.
    if available tqFRWTreeViewByApiFields then
    do:
        if tqFRWTreeViewByApiFields.tlFRWTreeViewIsShared = true and 
           tqFRWTreeViewByApiFields.tiFRWTreeView_ID <> t_sFRWTreeView.FRWTreeView_ID then 
        do:
            assign vcMessage      = trim(#T-97'A report tree view with the same properties already exists.':80(498170239)T-97#)        
                   oiReturnStatus = -1.  

            <M-4 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-470587':U (icFcMsgNumber), 
                input  '' (icFcExplanation), 
                input  '' (icFcIdentification), 
                input  '' (icFcContext), 
                output viFcReturnSuper (oiReturnStatus)) in BFRWTreeView>   
                    
        end. 
        if tqFRWTreeViewByApiFields.tlFRWTreeViewIsShared = false and t_sFRWTreeView.FRWTreeViewIsShared = false and 
           t_sFRWTreeView.Usr_ID = tqFRWTreeViewByApiFields.tiUsr_ID and 
           tqFRWTreeViewByApiFields.tiFRWTreeView_ID <> t_sFRWTreeView.FRWTreeView_ID then 
        do:
            assign vcMessage      = trim(#T-38'A report tree view with the same properties already exists.':80(498170239)T-38#)        
                   oiReturnStatus = -1.  

            <M-68 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-794692':U (icFcMsgNumber), 
                input  '' (icFcExplanation), 
                input  '' (icFcIdentification), 
                input  '' (icFcContext), 
                output viFcReturnSuper (oiReturnStatus)) in BFRWTreeView>   
                    
       end. 
       if t_sFRWTreeView.FRWTreeViewIsShared = false and tqFRWTreeViewByApiFields.tlFRWTreeViewIsShared = true
                                                     and tqFRWTreeViewByApiFields.tiFRWTreeView_ID <> t_sFRWTreeView.FRWTreeView_ID then
       do:
           assign vcMessage      = trim(#T-29'You can modify the existing shared view to make it non-shared, but you cannot create a new tree view':255(222347230)T-29#)       
                  oiReturnStatus = -1.  
         
           <M-59 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-306500':U (icFcMsgNumber), 
               input  '' (icFcExplanation), 
               input  '' (icFcIdentification), 
               input  '' (icFcContext), 
               output viFcReturnSuper (oiReturnStatus)) in BFRWTreeView>    
                    
       end.      
       if tqFRWTreeViewByApiFields.tlFRWTreeViewIsShared = true and t_sFRWTreeView.FRWTreeViewIsShared = false
                                                                and tqFRWTreeViewByApiFields.tiFRWTreeView_ID = t_sFRWTreeView.FRWTreeView_ID
       then assign  t_sFRWTreeView.Usr_ID = viUsrId.
            
       end. /*find first tqFRWTreeViewByApiFields */
end.