project QadFinancials > class BFRWTreeView > method AdditionalUpdates

Description

This method is part of the SetPublicTables flow.
When executed, data in the input class tables (prefix t_s) is validated and found correct, and copied into the class tables (prefix t_o).
This method can be extended to do updates that do not require a validation or that involve running business methods of other business classes. These classes should be started with ADD-TO-TRANSACTION = 'true'. Also make sure to add these classes in method StopExternalInstances.


Parameters


oiReturnStatusoutputinteger


Internal usage


QadFinancials
method BFRWTreeView.UpdateFRWTreeNodeId


program code (program/bfrwtreeview.p)

<ANCESTOR-CODE>



/* =================================================================== */
/* Get Primery key of FRWTreeView which has the same                   */
/* perameters as tFRWTreeView                                          */
/* =================================================================== */
empty temp-table tNewFRWTreeView.
for each tFRWTreeView where 
         tFRWTreeView.tc_Status <> "D":U and 
         tFRWTreeView.FRWTreeViewIsShared = true 
         no-lock:
    
    <Q-2 run FRWTreeViewByApiFields (all) (Read) (NoCache)
       (input ?, (UsrId)
        input tFRWTreeView.FRWAnCode_ID, (FRWAnCodeId)
        input tFRWTreeView.FRWCube_ID, (FRWCubeId)
        input tFRWTreeView.FRWTreeViewAmountsIn, (FRWTreeViewAmountIn)
        input tFRWTreeView.FRWTreeViewReportPeriodFrom, (FRWTreeViewReportPeriodFrom)
        input tFRWTreeView.FRWTreeViewReportPeriodTo, (FRWTreeViewReportPeriodTo)
        input tFRWTreeView.FRWTreeViewReportYearFrom, (FRWTreeViewReportYearFrom)
        input tFRWTreeView.FRWTreeViewReportYearTo, (FRWTreeViewReportYearTo)
        input tFRWTreeView.FRWTreeNode_ID, (FRWTreeNodeId)
        output dataset tqFRWTreeViewByApiFields) in BFRWTreeView>
    find first tqFRWTreeViewByApiFields no-lock no-error.
    if not available tqFRWTreeViewByApiFields
    then next.
    
    for each tqFRWTreeViewByApiFields  where
             tqFRWTreeViewByApiFields.tlFRWTreeViewIsShared  =  false and
             tqFRWTreeViewByApiFields.tiFRWTreeView_ID      <> tFRWTreeView.FRWTreeView_ID  :
        create tNewFRWTreeView.
        buffer-copy tqFRWTreeViewByApiFields to tNewFRWTreeView.
        assign tNewFRWTreeView.FRWTreeView_ID = tqFRWTreeViewByApiFields.tiFRWTreeView_ID.
    end. /* for each tqFRWTreeViewByApiFields  where */
    
end. /* for each tFRWTreeView where */

/* =================================================================== */
/* Load data and set status as "D"                                     */
/* =================================================================== */
for each tNewFRWTreeView 
         no-lock:
    if vcListFRWTreeViewIds = '':U
    then assign vcListFRWTreeViewIds = string(tNewFRWTreeView.FRWTreeView_ID).
    else assign vcListFRWTreeViewIds = vcListFRWTreeViewIds + chr(4) + string(tNewFRWTreeView.FRWTreeView_ID).

    /* if vcListFRWTreeViewIds > 10000, load the data to prevent vcListFRWTreeViewIds to get out of 32K limit */
    if length(vcListFRWTreeViewIds , "CHARACTER") > 10000
    then do:
        /* If we do a DataLoad here then vlFcDataValidated will be set to false again. */
        /* As we only want to mark a FRWTreeView-record for Deletion and as all info for doing so has already been validated, we consider it to be okay to delete this FRWTreeView record without validating that */
        /* To avoid we get error 'BLF-308: Data to save () has not been validated", we will manually assign vlFcDataValidated to true after the DataLoad if it was already true before the DataLoad */
        assign vlPreviousFcDataValidated = vlFcDataValidated.    
        <M-86 run DataLoad
           (input  ? (icRowids), 
            input  vcListFRWTreeViewIds (icPkeys), 
            input  ? (icObjectIds), 
            input  ? (icFreeform), 
            input  yes (ilKeepPrevious), 
            output viFcReturnSuper (oiReturnStatus)) in BFRWTreeView>
        if vlPreviousFcDataValidated = true
        then assign vlFcDataValidated = true.
        
        if viFcReturnSuper < 0 or (viFcReturnSuper > 0 and oiReturnStatus = 0)
        then assign oiReturnStatus = viFcReturnSuper.
        
        assign vcListFRWTreeViewIds = '':U.
    end. /* if length(vcListFRWTreeViewIds , "CHARACTER") > 10000 */    
end. /* for each tNewFRWTreeView no-lock: */ 

if vcListFRWTreeViewIds <> ''
then do:
    assign vlPreviousFcDataValidated = vlFcDataValidated. 
    <M-10 run DataLoad
       (input  ? (icRowids), 
        input  vcListFRWTreeViewIds (icPkeys), 
        input  ? (icObjectIds), 
        input  ? (icFreeform), 
        input  yes (ilKeepPrevious), 
        output viFcReturnSuper (oiReturnStatus)) in BFRWTreeView>
    if vlPreviousFcDataValidated = true
    then assign vlFcDataValidated = true.

    if viFcReturnSuper < 0 or (viFcReturnSuper > 0 and oiReturnStatus = 0)
    then assign oiReturnStatus = viFcReturnSuper.     
end. /* if vcListFRWTreeViewIds <> '' */

for each tFRWTreeView where tFRWTreeView.tc_Status = "":U:
    if can-find (first tNewFRWTreeView where tNewFRWTreeView.FRWTreeView_ID = tFRWTreeView.FRWTreeView_ID)
    then assign tFRWTreeView.tc_Status = "D":U.
end. /* for each tNewFRWTreeView no-lock */