project QadFinancials > class BRevaluationSaf > method UpdateRevalGLSafCombined

Description

Method to check existence of a RevalGLSafCombined record. Create it if it doesn't exist yet. This method receives three variables with maximum 5 saf-id's and it returns the RevalGLSafCombinedID.


Parameters


icCostCentreSafIdsinputcharacter
icGLSafIdsinputcharacter
icProjectSafIdsinputcharacter
iiCostCentreSafStructureIDinputinteger
iiGLSafStructureIDinputinteger
iiProjectSafStructureIDinputinteger
oiRevalGLSafCombinedIdoutputinteger
oiReturnStatusoutputintegerReturn status of the method.


Internal usage


QadFinancials
method BRevaluationSaf.UpdateRevalSafs


program code (program6/brevaluationsaf.p)

assign oiRevalGLSafCombinedId = 0.

<Q-1 run RevalGLSafCombinedByIds (all) (Read) (NoCache)
          (input int(entry(1,icCostCentreSafIds)), (CostCentre1SafID)
           input int(entry(2,icCostCentreSafIds)), (CostCentre2SafID)
           input int(entry(3,icCostCentreSafIds)), (CostCentre3SafID)
           input int(entry(4,icCostCentreSafIds)), (CostCentre4SafID)
           input int(entry(5,icCostCentreSafIds)), (CostCentre5SafID)
           input iiCostCentreSafStructureID, (CostCentreSafStructureID)
           input int(entry(1,icGLSafIds)), (GL1SafID)
           input int(entry(2,icGLSafIds)), (GL2SafID)
           input int(entry(3,icGLSafIds)), (GL3SafID)
           input int(entry(4,icGLSafIds)), (GL4SafID)
           input int(entry(5,icGLSafIds)), (GL5SafID)
           input iiGLSafStructureID, (GLSafStructureID)
           input int(entry(1,icProjectSafIds)), (Project1SafID)
           input int(entry(2,icProjectSafIds)), (Project2SafID)
           input int(entry(3,icProjectSafIds)), (Project3SafID)
           input int(entry(4,icProjectSafIds)), (Project4SafID)
           input int(entry(5,icProjectSafIds)), (Project5SafID)
           input iiProjectSafStructureID, (ProjectSafStructureID)
           input ?, (RevalGLSafCombined_Id)
           output dataset tqRevalGLSafCombinedByIds) in BRevaluationSaf >

find tqRevalGLSafCombinedByIds where
     tqRevalGLSafCombinedByIds.tiProject1Saf_ID             = integer(entry(1, icProjectSafIDs))    and 
     tqRevalGLSafCombinedByIds.tiProject2Saf_ID             = integer(entry(2, icProjectSafIDs))    and 
     tqRevalGLSafCombinedByIds.tiProject3Saf_ID             = integer(entry(3, icProjectSafIDs))    and 
     tqRevalGLSafCombinedByIds.tiProject4Saf_ID             = integer(entry(4, icProjectSafIDs))    and 
     tqRevalGLSafCombinedByIds.tiProject5Saf_ID             = integer(entry(5, icProjectSafIDs))    and 
     tqRevalGLSafCombinedByIds.tiCostCentre1Saf_ID          = integer(entry(1, icCostCentreSafIDs)) and 
     tqRevalGLSafCombinedByIds.tiCostCentre2Saf_ID          = integer(entry(2, icCostCentreSafIDs)) and
     tqRevalGLSafCombinedByIds.tiCostCentre3Saf_ID          = integer(entry(3, icCostCentreSafIDs)) and
     tqRevalGLSafCombinedByIds.tiCostCentre4Saf_ID          = integer(entry(4, icCostCentreSafIDs)) and
     tqRevalGLSafCombinedByIds.tiCostCentre5Saf_ID          = integer(entry(5, icCostCentreSafIDs)) and
     tqRevalGLSafCombinedByIds.tiGL1Saf_ID                  = integer(entry(1, icGLSafIDs))         and
     tqRevalGLSafCombinedByIds.tiGL2Saf_ID                  = integer(entry(2, icGLSafIDs))         and
     tqRevalGLSafCombinedByIds.tiGL3Saf_ID                  = integer(entry(3, icGLSafIDs))         and
     tqRevalGLSafCombinedByIds.tiGL4Saf_ID                  = integer(entry(4, icGLSafIDs))         and
     tqRevalGLSafCombinedByIds.tiGL5Saf_ID                  = integer(entry(5, icGLSafIDs))         and
     tqRevalGLSafCombinedByIds.tiProjectSafStructure_ID     = iiProjectSafStructureID               and
     tqRevalGLSafCombinedByIds.tiCostCentreSafStructure_ID  = iiCostCentreSafStructureID         and
     tqRevalGLSafCombinedByIds.tiGLSafStructure_ID          = iiGLSafStructureID
     no-error.
if not available tqRevalGLSafCombinedByIds
then do:
    <M-2 run AddDetailLine (input  'RevalGLSafCombined':U (icTable), 
                        input  '':U (icParentRowid), 
                        output viFcReturnSuper (oiReturnStatus)) in BRevaluationSaf>
    if viFcReturnSuper <> 0
    then return.

    assign tRevalGLSafCombined.Project1Saf_ID            = integer(entry(1, icProjectSafIDs))     
           tRevalGLSafCombined.Project2Saf_ID            = integer(entry(2, icProjectSafIDs))     
           tRevalGLSafCombined.Project3Saf_ID            = integer(entry(3, icProjectSafIDs))     
           tRevalGLSafCombined.Project4Saf_ID            = integer(entry(4, icProjectSafIDs))     
           tRevalGLSafCombined.Project5Saf_ID            = integer(entry(5, icProjectSafIDs))     
           tRevalGLSafCombined.CostCentre1Saf_ID         = integer(entry(1, icCostCentreSafIDs))  
           tRevalGLSafCombined.CostCentre2Saf_ID         = integer(entry(2, icCostCentreSafIDs)) 
           tRevalGLSafCombined.CostCentre3Saf_ID         = integer(entry(3, icCostCentreSafIDs)) 
           tRevalGLSafCombined.CostCentre4Saf_ID         = integer(entry(4, icCostCentreSafIDs)) 
           tRevalGLSafCombined.CostCentre5Saf_ID         = integer(entry(5, icCostCentreSafIDs)) 
           tRevalGLSafCombined.GL1Saf_ID                 = integer(entry(1, icGLSafIDs))         
           tRevalGLSafCombined.GL2Saf_ID                 = integer(entry(2, icGLSafIDs))         
           tRevalGLSafCombined.GL3Saf_ID                 = integer(entry(3, icGLSafIDs))         
           tRevalGLSafCombined.GL4Saf_ID                 = integer(entry(4, icGLSafIDs))         
           tRevalGLSafCombined.GL5Saf_ID                 = integer(entry(5, icGLSafIDs))
           tRevalGLSafCombined.ProjectSafStructure_ID    = iiProjectSafStructureID
           tRevalGLSafCombined.CostCentreSafStructure_ID = iiCostCentreSafStructureID
           tRevalGLSafCombined.GLSafStructure_ID         = iiGLSafStructureID

           oiRevalGLSafCombinedId                        = tRevalGLSafCombined.RevalGLSafCombined_ID.

end.
else assign oiRevalGLSafCombinedId = tqRevalGLSafCombinedByIds.tiRevalGLSafCombined_ID.