project QadFinancials > class BAltCOAStruct > method ValidateComponentPreSeq

Description

Fill in sequence, level and isLeaf fields for AltCOAStructDet


Parameters


iiParentAltCOAStructDetIdinputinteger
icParentSequenceinputcharacter
iiParentLevelinputinteger
odChildrenCounteroutputdecimal
oiReturnStatusoutputintegerReturn status of the method.


Internal usage


QadFinancials
method BAltCOAStruct.ValidateComponentPre
method BAltCOAStruct.ValidateComponentPreSeq


program code (program5/baltcoastruct.p)

/* thid method is a recursion method for filling in sequence, level and leaf fields */
assign vdSequence        = 0
       vdChildrenCounter = 0
       odChildrenCounter = 0.
/* find all the children records */
for each bAltCOAStructDet where bAltCOAStructDet.ParentAltCOAStructDet_ID = iiParentAltCOAStructDetId and
                                  bAltCOAStructDet.tc_Status                <> "D":U:
    /* assign value for the record */
    assign vdSequence = vdSequence + 1           
           bAltCOAStructDet.AltCOAStructDetSeq   = icParentSequence + string(vdSequence, "999")
           bAltCOAStructDet.AltCOAStructDetLevel = iiParentLevel + 1
           odChildrenCounter                     = odChildrenCounter + 1.   

    /* call this method itself for handling the children records */
    <M-1 run ValidateComponentPreSeq
       (input  bAltCOAStructDet.AltCOAStructDet_ID (iiParentAltCOAStructDetId), 
        input  bAltCOAStructDet.AltCOAStructDetSeq (icParentSequence), 
        input  bAltCOAStructDet.AltCOAStructDetLevel (iiParentLevel), 
        output vdChildrenCounter (odChildrenCounter), 
        output viFcReturnSuper (oiReturnStatus)) in BAltCOAStruct>  
    if vdChildrenCounter = 0
    then assign bAltCOAStructDet.AltCOAStructDetIsLeaf = true.
end.