project QadFinancials > class TFRWTreeView > method GetFRWTreeLevel2NodeCreateDummyData


Parameters


oiReturnStatusoutputintegerReturn status of the method.


Internal usage


QadFinancials
method TFRWTreeView.GetFRWTreeLevel2Node


program code (program1/tfrwtreeview.p)

/* now we can start building the tree in the temp-table */
empty temp-table tNewnode.

assign vilastnodeleaftype = 0
       viDummyNodeID      = -1
       viLastNodeID       = 0
       vlHasDetails       = no.

for each tnode no-lock:  
    create tnewnode.
    buffer-copy tnode to tnewnode.
    assign vilastnodeleaftype   = tNode.tiLeafType
            vilastnodeid        = tNode.tiNodeID
            viLastNodeGeoNumber = tNode.tiGeoNumber
            vlHasDetails        = tNode.tlHasDetails.

    if vilastnodeleaftype = 1 and not vlHasDetails
    then do:
        assign tNewNode.tiLeafType = 3.
    end.

    if vilastnodeleaftype = 1 and vlHasDetails then
    do:
        create tnewnode.
        assign tnewnode.tinodeid           = vidummynodeid
                tNewNode.tiParentNodeID    = viLastNodeID
                tNewNode.tcNodeName        = 'No Data':U
                tNewNode.tcNodeDescription = 'No Data':U
                tNewNode.tiLeafType        = 2
                tNewNode.tiSequence        = 1
                tNewNode.tiGeoNumber       = viLastNodeGeoNumber + 1
                viDummyNodeID              = viDummyNodeID - 1.

        /* if there's blank row existing */
        if can-find (first bnode where bNode.tiNodeID = 0 and bNode.tiGeoNumber = (tNode.tiGeoNumber + 1) no-lock) then
        do:
            assign tNewNode.tiGeoNumber    = viLastNodeGeoNumber + 2.
        end.
    end.
end.