project BLF > class BWorkObject > 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/bworkobject.p)

<ANCESTOR-CODE>
    
        
    /* ============================================================================================ */
    /* Make sure to fill tWorkObject.tcBusComponentLabel when tWorkObject.BusComponent_ID is filled */
    /* tWorkObject.tcBusComponentLabel is a RelKeyBusField on BusActivity_ID but is used for both   */
    /* ============================================================================================ */
    <Q-2 run BusComponentPrim (Start) in BBusinessComponent >
    for each tWorkObject where 
             (tWorkObject.BusComponent_ID <> 0 and tWorkObject.BusComponent_ID <> ?) and 
             (tWorkObject.tcBusComponentCode = "":U or tWorkObject.tcBusComponentCode = ?) :

        if vlDataLoadKeepPrevious and can-find (tAlreadyCalculatedRecords where
                 tAlreadyCalculatedRecords.tcTableName = "WorkObject " and
                 tAlreadyCalculatedRecords.tc_Rowid = tWorkObject .tc_Rowid)
        then next.                          
             
        <Q-1 run BusComponentPrim (all)  (Read)  (Cache)  (input tWorkObject.BusComponent_ID, (BusComponentID) 
                           input ?, (BusComponentCode)
                           output dataset tqBusComponentPrim) in BBusinessComponent >
        find first tqBusComponentPrim no-error.
        if available tqBusComponentPrim
        then assign tWorkObject.tcBusComponentCode = tqBusComponentPrim.tcBusComponentCode.
    end. /* for each tWorkObject */
    <Q-3 run BusComponentPrim (Stop) in BBusinessComponent >