project QadFinancials > class BSafStructure > 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/bsafstructure.p)

<ANCESTOR-CODE>

/* check whether the safstructure is used */
for each tSafStructure:

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

    <Q-2 assign vlFcQueryRecordsAvailable = GetLinkForSafStucture (NoCache)  (input tSafStructure.SafStructure_ID, (SafStructureId)) in BSafStructureLink >
    if vlFcQueryRecordsAvailable = no
    then assign tSafStructure.tlSafStructureIsUsed = no.
    else assign tSafStructure.tlSafStructureIsUsed = yes.

    for each tSafStructureLine where
             tSafStructureLine.tc_ParentRowid = tSafStructure.tc_Rowid:
        <Q-1 run GetSafConceptCode (all) (Read) (NoCache)
              (input tSafStructureLine.SafConcept_ID, (SafConcept_ID)
               output dataset tqGetSafConceptCode) in BSafConcept >
        find first tqGetSafConceptCode no-error.
        if available tqGetSafConceptCode
        then assign tSafStructureLine.tcSafConceptCode = tqGetSafConceptCode.tcSafConceptCode.
    
        <Q-3 run SafPrim (all)  (Read)  (NoCache)  (input tSafStructureLine.Saf_ID, (SafID) 
                      input ?, (SafCode) 
                      input ?, (SafConceptCode)
                      output dataset tqSafPrim) in BSaf >
        find first tqSafPrim no-error.
        if available tqSafPrim
        then assign tSafStructureLine.tcSafCode = tqSafPrim.tcSafCode.
    
    end.
end.