project QadFinancials > class BFRWChart > method ValidateComponentAllSafConcepts

validation procedure

Description

Validation method for saf concepts


Parameters


oiReturnStatusoutputintegerReturn status of the method.


Internal usage


QadFinancials
method BFRWChart.ValidateComponentAll


program code (program5/bfrwchart.p)

/* ====================================================================================== *
 * Method       : ValidateComponentAllSafConcepts                                         *
 * Description  : This method validates saf concepts                                      *
 * ====================================================================================== */

MAIN_BLOCK:
do on error undo, throw: 

    assign viIndex = 1.
    do while viIndex  < 11:
        vcSafConceptArray[viIndex] = '':U.
        assign viIndex = viIndex + 1.
    end.

    /********************************************************************************/
    /* Check if Saf Concept code is valid */
    /********************************************************************************/
    if t_sFRWChart.FRWChartSafConcept01 <> ?    and
       t_sFRWChart.FRWChartSafConcept01 <> '':U 
    then do:
        assign vcSafConceptArray[1] = t_sFRWChart.FRWChartSafConcept01.
        <Q-20 run SafConceptPrim (all) (Read) (NoCache)
           (input ?, (SafConceptID)
            input t_sFRWChart.FRWChartSafConcept01, (SafConceptCode)
            output dataset tqSafConceptPrim) in BSafConcept>
        find first tqSafConceptPrim no-error.
        if not available tqSafConceptPrim
        then do:
            assign vcMessage      = trim(substitute(#T-4'SAF Concept &1 does not exist.':100(125670308)T-4#, "1":U))
                   oiReturnStatus = -1.
            <M-35 run SetMessage
               (input  vcMessage (icMessage), 
                input  '':U (icArguments), 
                input  'tFRWChart.FRWChartsafConcept01':U (icFieldName), 
                input  t_sFRWChart.FRWChartSafConcept01 (icFieldValue), 
                input  'E':U (icType), 
                input  3 (iiSeverity), 
                input  '':U (icRowid), 
                input  'qadfin-54681':U (icFcMsgNumber), 
                input  '':U (icFcExplanation), 
                input  '':U (icFcIdentification), 
                input  '':U (icFcContext), 
                output viFcReturnSuper (oiReturnStatus)) in BFRWChart>                       
        end.
    end. 
    
    if t_sFRWChart.FRWChartSafConcept02 <> ?    and
       t_sFRWChart.FRWChartSafConcept02 <> '':U 
    then do:
        assign vcSafConceptArray[2] = t_sFRWChart.FRWChartSafConcept02.
        <Q-25 run SafConceptPrim (all) (Read) (NoCache)
           (input ?, (SafConceptID)
            input t_sFRWChart.FRWChartSafConcept02, (SafConceptCode)
            output dataset tqSafConceptPrim) in BSafConcept>
        find first tqSafConceptPrim no-error.
        if not available tqSafConceptPrim
        then do:
            assign vcMessage      = trim(substitute(#T-22'SAF Concept &1 does not exist.':100(125670308)T-22#, "2":U))
                   oiReturnStatus = -1.
            <M-31 run SetMessage
               (input  vcMessage (icMessage), 
                input  '':U (icArguments), 
                input  'tFRWChart.FRWChartsafConcept02':U (icFieldName), 
                input  t_sFRWChart.FRWChartSafConcept02 (icFieldValue), 
                input  'E':U (icType), 
                input  3 (iiSeverity), 
                input  '':U (icRowid), 
                input  'qadfin-120023':U (icFcMsgNumber), 
                input  '':U (icFcExplanation), 
                input  '':U (icFcIdentification), 
                input  '':U (icFcContext), 
                output viFcReturnSuper (oiReturnStatus)) in BFRWChart>                       
        end.
    end.
    
    if t_sFRWChart.FRWChartSafConcept03 <> ?    and
       t_sFRWChart.FRWChartSafConcept03 <> '':U 
    then do:
        assign vcSafConceptArray[3] = t_sFRWChart.FRWChartSafConcept03.
        <Q-68 run SafConceptPrim (all) (Read) (NoCache)
           (input ?, (SafConceptID)
            input t_sFRWChart.FRWChartSafConcept03, (SafConceptCode)
            output dataset tqSafConceptPrim) in BSafConcept>
        find first tqSafConceptPrim no-error.
        if not available tqSafConceptPrim
        then do:
            assign vcMessage      = trim(substitute(#T-54'SAF Concept &1 does not exist.':100(125670308)T-54#, "3":U))
                   oiReturnStatus = -1.
            <M-69 run SetMessage
               (input  vcMessage (icMessage), 
                input  '':U (icArguments), 
                input  'tFRWChart.FRWChartsafConcept03':U (icFieldName), 
                input  t_sFRWChart.FRWChartSafConcept03 (icFieldValue), 
                input  'E':U (icType), 
                input  3 (iiSeverity), 
                input  '':U (icRowid), 
                input  'qadfin-228073':U (icFcMsgNumber), 
                input  '':U (icFcExplanation), 
                input  '':U (icFcIdentification), 
                input  '':U (icFcContext), 
                output viFcReturnSuper (oiReturnStatus)) in BFRWChart>                       
        end.
    end.
    
    if t_sFRWChart.FRWChartSafConcept04 <> ?    and
       t_sFRWChart.FRWChartSafConcept04 <> '':U 
    then do:
        assign vcSafConceptArray[4] = t_sFRWChart.FRWChartSafConcept04.
        <Q-72 run SafConceptPrim (all) (Read) (NoCache)
           (input ?, (SafConceptID)
            input t_sFRWChart.FRWChartSafConcept04, (SafConceptCode)
            output dataset tqSafConceptPrim) in BSafConcept>
        find first tqSafConceptPrim no-error.
        if not available tqSafConceptPrim
        then do:
            assign vcMessage      = trim(substitute(#T-62'SAF Concept &1 does not exist.':100(125670308)T-62#, "4":U))
                   oiReturnStatus = -1.
            <M-53 run SetMessage
               (input  vcMessage (icMessage), 
                input  '':U (icArguments), 
                input  'tFRWChart.FRWChartsafConcept04':U (icFieldName), 
                input  t_sFRWChart.FRWChartSafConcept04 (icFieldValue), 
                input  'E':U (icType), 
                input  3 (iiSeverity), 
                input  '':U (icRowid), 
                input  'qadfin-314470':U (icFcMsgNumber), 
                input  '':U (icFcExplanation), 
                input  '':U (icFcIdentification), 
                input  '':U (icFcContext), 
                output viFcReturnSuper (oiReturnStatus)) in BFRWChart>                       
        end.
    end.
    
    if t_sFRWChart.FRWChartSafConcept05 <> ?    and
       t_sFRWChart.FRWChartSafConcept05 <> '':U 
    then do:
        assign vcSafConceptArray[5] = t_sFRWChart.FRWChartSafConcept05.
        <Q-28 run SafConceptPrim (all) (Read) (NoCache)
           (input ?, (SafConceptID)
            input t_sFRWChart.FRWChartSafConcept05, (SafConceptCode)
            output dataset tqSafConceptPrim) in BSafConcept>
        find first tqSafConceptPrim no-error.
        if not available tqSafConceptPrim
        then do:
            assign vcMessage      = trim(substitute(#T-43'SAF Concept &1 does not exist.':100(125670308)T-43#, "5":U))
                   oiReturnStatus = -1.
            <M-89 run SetMessage
               (input  vcMessage (icMessage), 
                input  '':U (icArguments), 
                input  'tFRWChart.FRWChartsafConcept05':U (icFieldName), 
                input  t_sFRWChart.FRWChartSafConcept05 (icFieldValue), 
                input  'E':U (icType), 
                input  3 (iiSeverity), 
                input  '':U (icRowid), 
                input  'qadfin-515829':U (icFcMsgNumber), 
                input  '':U (icFcExplanation), 
                input  '':U (icFcIdentification), 
                input  '':U (icFcContext), 
                output viFcReturnSuper (oiReturnStatus)) in BFRWChart>                       
        end.
    end.
    
    if t_sFRWChart.FRWChartSafConcept06 <> ?    and
       t_sFRWChart.FRWChartSafConcept06 <> '':U 
    then do:
        assign vcSafConceptArray[6] = t_sFRWChart.FRWChartSafConcept06.
        <Q-98 run SafConceptPrim (all) (Read) (NoCache)
           (input ?, (SafConceptID)
            input t_sFRWChart.FRWChartSafConcept06, (SafConceptCode)
            output dataset tqSafConceptPrim) in BSafConcept>
        find first tqSafConceptPrim no-error.
        if not available tqSafConceptPrim
        then do:
            assign vcMessage      = trim(substitute(#T-36'SAF Concept &1 does not exist.':100(125670308)T-36#, "6":U))
                   oiReturnStatus = -1.
            <M-57 run SetMessage
               (input  vcMessage (icMessage), 
                input  '':U (icArguments), 
                input  'tFRWChart.FRWChartsafConcept06':U (icFieldName), 
                input  t_sFRWChart.FRWChartSafConcept06 (icFieldValue), 
                input  'E':U (icType), 
                input  3 (iiSeverity), 
                input  '':U (icRowid), 
                input  'qadfin-775895':U (icFcMsgNumber), 
                input  '':U (icFcExplanation), 
                input  '':U (icFcIdentification), 
                input  '':U (icFcContext), 
                output viFcReturnSuper (oiReturnStatus)) in BFRWChart>                       
        end.
    end.
    
    if t_sFRWChart.FRWChartSafConcept07 <> ?    and
       t_sFRWChart.FRWChartSafConcept07 <> '':U 
    then do:
        assign vcSafConceptArray[7] = t_sFRWChart.FRWChartSafConcept07.
        <Q-73 run SafConceptPrim (all) (Read) (NoCache)
           (input ?, (SafConceptID)
            input t_sFRWChart.FRWChartSafConcept07, (SafConceptCode)
            output dataset tqSafConceptPrim) in BSafConcept>
        find first tqSafConceptPrim no-error.
        if not available tqSafConceptPrim
        then do:
            assign vcMessage      = trim(substitute(#T-19'SAF Concept &1 does not exist.':100(125670308)T-19#, "7":U))
                   oiReturnStatus = -1.
            <M-16 run SetMessage
               (input  vcMessage (icMessage), 
                input  '':U (icArguments), 
                input  'tFRWChart.FRWChartsafConcept07':U (icFieldName), 
                input  t_sFRWChart.FRWChartSafConcept07 (icFieldValue), 
                input  'E':U (icType), 
                input  3 (iiSeverity), 
                input  '':U (icRowid), 
                input  'qadfin-763263':U (icFcMsgNumber), 
                input  '':U (icFcExplanation), 
                input  '':U (icFcIdentification), 
                input  '':U (icFcContext), 
                output viFcReturnSuper (oiReturnStatus)) in BFRWChart>                       
        end.
    end.
    
    if t_sFRWChart.FRWChartSafConcept08 <> ?    and
       t_sFRWChart.FRWChartSafConcept08 <> '':U 
    then do:
        assign vcSafConceptArray[8] = t_sFRWChart.FRWChartSafConcept08.
        <Q-56 run SafConceptPrim (all) (Read) (NoCache)
           (input ?, (SafConceptID)
            input t_sFRWChart.FRWChartSafConcept08, (SafConceptCode)
            output dataset tqSafConceptPrim) in BSafConcept>
        find first tqSafConceptPrim no-error.
        if not available tqSafConceptPrim
        then do:
            assign vcMessage      = trim(substitute(#T-55'SAF Concept &1 does not exist.':100(125670308)T-55#, "8":U))
                   oiReturnStatus = -1.
            <M-37 run SetMessage
               (input  vcMessage (icMessage), 
                input  '':U (icArguments), 
                input  'tFRWChart.FRWChartsafConcept08':U (icFieldName), 
                input  t_sFRWChart.FRWChartSafConcept08 (icFieldValue), 
                input  'E':U (icType), 
                input  3 (iiSeverity), 
                input  '':U (icRowid), 
                input  'qadfin-162526':U (icFcMsgNumber), 
                input  '':U (icFcExplanation), 
                input  '':U (icFcIdentification), 
                input  '':U (icFcContext), 
                output viFcReturnSuper (oiReturnStatus)) in BFRWChart>                       
        end.
    end.
    
    if t_sFRWChart.FRWChartSafConcept09 <> ?    and
       t_sFRWChart.FRWChartSafConcept09 <> '':U 
    then do:
        assign vcSafConceptArray[9] = t_sFRWChart.FRWChartSafConcept09.
        <Q-76 run SafConceptPrim (all) (Read) (NoCache)
           (input ?, (SafConceptID)
            input t_sFRWChart.FRWChartSafConcept09, (SafConceptCode)
            output dataset tqSafConceptPrim) in BSafConcept>
        find first tqSafConceptPrim no-error.
        if not available tqSafConceptPrim
        then do:
            assign vcMessage      = trim(substitute(#T-13'SAF Concept &1 does not exist.':100(125670308)T-13#, "9":U))
                   oiReturnStatus = -1.
            <M-30 run SetMessage
               (input  vcMessage (icMessage), 
                input  '':U (icArguments), 
                input  'tFRWChart.FRWChartsafConcept09':U (icFieldName), 
                input  t_sFRWChart.FRWChartSafConcept09 (icFieldValue), 
                input  'E':U (icType), 
                input  3 (iiSeverity), 
                input  '':U (icRowid), 
                input  'qadfin-812816':U (icFcMsgNumber), 
                input  '':U (icFcExplanation), 
                input  '':U (icFcIdentification), 
                input  '':U (icFcContext), 
                output viFcReturnSuper (oiReturnStatus)) in BFRWChart>                       
        end.
    end.
    
    if t_sFRWChart.FRWChartSafConcept10 <> ?    and
       t_sFRWChart.FRWChartSafConcept10 <> '':U 
    then do:
        assign vcSafConceptArray[10] = t_sFRWChart.FRWChartSafConcept10.
        <Q-87 run SafConceptPrim (all) (Read) (NoCache)
           (input ?, (SafConceptID)
            input t_sFRWChart.FRWChartSafConcept10, (SafConceptCode)
            output dataset tqSafConceptPrim) in BSafConcept>
        find first tqSafConceptPrim no-error.
        if not available tqSafConceptPrim
        then do:
            assign vcMessage      = trim(substitute(#T-46'SAF Concept &1 does not exist.':100(125670308)T-46#, "10":U))
                   oiReturnStatus = -1.
            <M-34 run SetMessage
               (input  vcMessage (icMessage), 
                input  '':U (icArguments), 
                input  'tFRWChart.FRWChartsafConcept10':U (icFieldName), 
                input  t_sFRWChart.FRWChartSafConcept10 (icFieldValue), 
                input  'E':U (icType), 
                input  3 (iiSeverity), 
                input  '':U (icRowid), 
                input  'qadfin-270893':U (icFcMsgNumber), 
                input  '':U (icFcExplanation), 
                input  '':U (icFcIdentification), 
                input  '':U (icFcContext), 
                output viFcReturnSuper (oiReturnStatus)) in BFRWChart>                       
        end.
    end.
    
    /********************************************************************************/
    /* Check if there is a gap */
    /********************************************************************************/
    assign viIndex = 2.
    do while viIndex  < 11:
        if vcSafConceptArray[viIndex - 1] = '':U and vcSafConceptArray[viIndex] <> '':U
        then do:
            assign vcMessage      = trim(substitute(#T-26'SAF Concept &1 cannot be entered if SAF Concept &2 is blank.':150(589870421)T-26#,string(viIndex),string(viIndex - 1)))
                   oiReturnStatus = -1
                   vcFieldName    = trim(#T-45'SAF Concept':30(3969)T-45#) + " " + string(viIndex).
            <M-84 run SetMessage
               (input  vcMessage (icMessage), 
                input  '':U (icArguments), 
                input  vcFieldName (icFieldName), 
                input  vcSafConceptArray[viIndex] (icFieldValue), 
                input  'E':U (icType), 
                input  3 (iiSeverity), 
                input  '':U (icRowid), 
                input  'qadfin-563381':U (icFcMsgNumber), 
                input  '':U (icFcExplanation), 
                input  '':U (icFcIdentification), 
                input  '':U (icFcContext), 
                output viFcReturnSuper (oiReturnStatus)) in BFRWChart>      
        end.
        assign viIndex = viIndex + 1.
    end. /* do while viIndex  < 11: */
    
    /********************************************************************************/
    /* Check if Saf Concept is duplicated */
    /********************************************************************************/ 
    assign viIndex  = 1.
    do while viIndex < 11:
        if vcSafConceptArray[viIndex] <> '':U
        then do:
            assign viIndex2 = viIndex + 1.
            do while viIndex2 < 11:
                if vcSafConceptArray[viIndex2] = vcSafConceptArray[viIndex]
                then do:
                    assign vcMessage                   = trim(substitute(#T-85'SAF Concept &1 cannot be the same as SAF Concept &2.':100(263048383)T-85#,string(viIndex2),string(viIndex)))
                           oiReturnStatus              = -1
                           vcFieldName                 = trim(#T-23'SAF Concept':30(3969)T-23#) + " " + string(viIndex2).                           
                    <M-67 run SetMessage
                       (input  vcMessage (icMessage), 
                        input  '':U (icArguments), 
                        input  vcFieldName (icFieldName), 
                        input  vcSafConceptArray[viIndex2] (icFieldValue), 
                        input  'E':U (icType), 
                        input  3 (iiSeverity), 
                        input  '':U (icRowid), 
                        input  'qadfin-110653':U (icFcMsgNumber), 
                        input  '':U (icFcExplanation), 
                        input  '':U (icFcIdentification), 
                        input  '':U (icFcContext), 
                        output viFcReturnSuper (oiReturnStatus)) in BFRWChart>
                    assign vcSafConceptArray[viIndex2] = '':U.                                              
                end.
                
                assign viIndex2 = viIndex2 + 1.           
            end.
        end. /* if vcSafConceptArray[viIndex] <> '':U */
        assign viIndex = viIndex + 1.
    end. /* do while viIndex < 11: */        
           
 
end. /* do on error undo, throw: */