project QadFinancials > class BDivision > method Calculate

Description

Add code here to initialize the calculated fields of the class temp-tables after loading existing records from the application database.


Parameters


oiReturnStatusoutputinteger


Internal usage


unused


program code (program/bdivision.p)

<ANCESTOR-CODE>
/* Fill in calculate field tiCOAMaskDiv_ID and tcCOAMaskDivCode */
for each tDivision:

    if vlDataLoadKeepPrevious and 
       can-find (tAlreadyCalculatedRecords where
                 tAlreadyCalculatedRecords.tcTableName = "Division" and
                 tAlreadyCalculatedRecords.tc_Rowid    = tDivision.tc_Rowid)
    then next.
    <Q-1 run DivisionForCOAMask (all) (Read) (NoCache)
       (input viCompanyId, (CompanyId)
        input tDivision.Division_ID, (DivisionId)
        input tDivision.DivisionCode, (DivisionCode)
        input ?, (COAMaskDivActive)
        output dataset tqDivisionForCOAMask) in BDivision >
    find first tqDivisionForCOAMask no-error.
    if available tqDivisionForCOAMask
    then do:
         assign tDivision.tiCOAMaskDiv_ID  = tqDivisionForCOAMask.tiCOAMaskDiv_ID
                tDivision.tcCOAMaskDivCode = tqDivisionForCOAMask.tcCOAMaskDivCode.
    end. /* if available tqDivisionForCOAMask */

    /* copy values of calculated fields into t_I records */
    find t_iDivision where
         t_iDivision.tc_Rowid = tDivision.tc_Rowid no-error.

    if available t_iDivision
    then buffer-copy tDivision to t_iDivision.
end. /* for each tDivision */