project BLF > class BCustomField > method AdditionalUpdates

Description

This method is part of the SetPublicTables flow.
When executed, data in the input class tables (prefix t_s) is validated and found correct, and copied into the class tables (prefix t_o).
This method can be extended to do updates that do not require a validation or that involve running business methods of other business classes. These classes should be started with ADD-TO-TRANSACTION = 'true'. Also make sure to add these classes in method StopExternalInstances.


Parameters


oiReturnStatusoutputinteger


Internal usage


unused


program code (program/bcustomfield.p)

<ANCESTOR-CODE>

if oiReturnStatus = 0
then assign oiReturnStatus = -98.

if can-find(first tStoredSearchesToCreateCF) or
   can-find(first tStoredSearchesToDeleteCF)
then do:
    if viBStoredSearchID = 0 or
       viBStoredSearchID = ?
    then do:
        <I-8 {bFcStartAndOpenInstance
             &ADD-TO-TRANSACTION   = "yes"
             &CLASS                = "BStoredSearch"}>
             
        assign vlBStoredSearchStarted = true.
    end.
    else do:
        <I-41 {bFcOpenInstance
             &CLASS           = "BStoredSearch"}>
    end.

    <M-43 run CreateAndDeleteStoredSearches
       (input-output tStoredSearchesToCreateCF (tStoredSearchesToCreate), 
        input  tStoredSearchesToDeleteCF (tStoredSearchesToDelete), 
        output viReturnStatus (oiReturnStatus)) in BStoredSearch>

    if viReturnStatus >= 0 and
       vlBStoredSearchStarted
    then do:
        assign viFcCount1 = viReturnStatus.
        <M-33 run ValidateBCAndAdditionalUpdates  (output viReturnStatus (oiReturnStatus)) in BStoredSearch>

        if viReturnStatus = 0
        then assign viReturnStatus = viFcCount1.
    end.

    <I-32 {bFcCloseInstance
         &CLASS           = "BStoredSearch"}>
         
    if viReturnStatus < 0
    then do:
        <M-66 run StopExternalInstances  (output viFcReturnSuper (oiReturnStatus)) in BCustomField>
        assign oiReturnStatus = viReturnStatus.
        return.
    end.

    if viReturnStatus > 0
    then assign oiReturnStatus = viReturnStatus.

    for each tStoredSearchesToCreateCF where
             tStoredSearchesToCreateCF.tiStoredSearch_ID <> 0:
        for each tCustomField where
                 tCustomField.tcStoredSearchLookupReference = tStoredSearchesToCreateCF.tcStoredSearchLookupRef and
                 tCustomField.tcStoredSearchName            = tStoredSearchesToCreateCF.tcStoredSearchName      and
                (tCustomField.tc_Status                     = "N"                                               or
                 tCustomField.tc_Status                     = "C"):
            assign tCustomField.StoredSearch_ID = tStoredSearchesToCreateCF.tiStoredSearch_ID.
        end.
    end.
end.

if oiReturnStatus = -98
then assign oiReturnStatus = 0.