project BLF > class BSODCategory > 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/bsodcategory.p)

<ANCESTOR-CODE>

for each tSODCategory on error undo, throw:

    if vlDataLoadKeepPrevious and can-find (tAlreadyCalculatedRecords where
             tAlreadyCalculatedRecords.tcTableName = "SODCategory" and
             tAlreadyCalculatedRecords.tc_Rowid = tSODCategory.tc_Rowid)
    then next.

    if can-find (first tSODCategoryResources where
                       tSODCategoryResources.tc_ParentRowid = tSODCategory.tc_Rowid)
    then next.
    
    <Q-1 run ResourceBySODCategory (all) (Read) (NoCache)
       (input tSODCategory.SODCategory_ID, (SODCategoryID)
        input '', (SODCategoryCode)
        input 0, (ResourceID)
        output dataset tqResourceBySODCategory) in BResource >
    for each tqResourceBySODCategory:
        virowid = virowid + 1.
        create tSODCategoryResources.
        assign tSODCategoryResources.tcResourceLabel = tqResourceBySODCategory.tcResourceLabel
               tSODCategoryResources.tcResourceURI   = tqResourceBySODCategory.tcResourceURI
               tSODCategoryResources.tc_Rowid        = string(virowid)
               tSODCategoryResources.tc_ParentRowid  = tSODCategory.tc_Rowid.
    end.
end.