project BLF > class BControlProperty > 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/bcontrolproperty.p)

<ANCESTOR-CODE>

for each tControlProperty on error undo, throw:

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

    if tControlProperty.ControlPropertyLayerType = {&CONTROLPROPERTYLAYERTYPE-ROLE} and
       (tControlProperty.tcRoleName = "" or tControlProperty.tcRoleName = ?)
    then do:
        <Q-5 run RolePrim (all) (Read) (NoCache)
           (input tControlProperty.ControlPropertyLayerValue, (RoleID)
            input ?, (RoleName)
            output dataset tqRolePrim) in BRole >
        find first tqRolePrim no-error.
        if available tqRolePrim
        then assign tControlProperty.tcRoleName = tqRolePrim.tcRoleName.
    end.
    if tControlProperty.ControlPropertyLayerType = {&CONTROLPROPERTYLAYERTYPE-USER} and
       (tControlProperty.tcUsrLogin = "" or tControlProperty.tcUsrLogin = ?)
    then do:
        <Q-6 run UserById (all) (Read) (NoCache)
           (input tControlProperty.ControlPropertyLayerValue, (UsrId)
            output dataset tqUserById) in BUser >
        find first tqUserById no-error.
        if available tqUserById
        then assign tControlProperty.tcUsrLogin = tqUserById.tcUsrLogin.
    end.
end.