project BLF > class BDomain > method SynchronizeSharedSet

Description

create defaults for domain - shared set references


Parameters


icsharedSetListinputcharacter
oiReturnStatusoutputintegerReturn status of the method.


Internal usage


BLF
method BSharedSet.ApiSynchronise


program code (program1/bdomain.p)

/* ================================================================= */
/* First load all domains.                                           */
/* ================================================================= */
<M-1 run DataLoad
   (input  '' (icRowids), 
    input  '' (icPkeys), 
    input  '' (icObjectIds), 
    input  '' (icFreeform), 
    input  no (ilKeepPrevious), 
    output viFcReturnSuper (oiReturnStatus)) in BDomain>
if viFcReturnSuper = -4
then do:
    /* no domains = no updates */
    return.
end.
if viFcReturnSuper <> 0
then oiReturnStatus = viFcReturnSuper.
if viFcReturnSuper < 0
then return.

/* ================================================================= */
/* Add the new shared sets.                                          */
/* ================================================================= */
for each tDomains on error undo, throw:
    do visco = num-entries(icsharedSetList) to 2 by -2:
        find first tDomainSharedSet where
                   tDomainSharedSet.tc_ParentRowid      = tDomains.tc_Rowid and
                   tDomainSharedSet.tcSharedSetTypeCode = entry(visco - 1,icsharedSetList) no-error.
        if available tDomainSharedSet
        then do:
            if tDomainSharedSet.tc_Status = "N"
            then tDomainSharedSet.tcSharedSetCode     = entry(visco,icsharedSetList).
        end.
        else do:
            <M-2 run AddDetailLine
               (input  'DomainSharedSet' (icTable), 
                input  tDomains.tc_Rowid (icParentRowid), 
                output viFcReturnSuper (oiReturnStatus)) in BDomain>
            if viFcReturnSuper <> 0
            then oiReturnStatus = viFcReturnSuper.
            if viFcReturnSuper < 0
            then return.
            assign tDomainSharedSet.tcSharedSetTypeCode = entry(visco - 1,icsharedSetList)
                   tDomainSharedSet.tcSharedSetCode     = entry(visco,icsharedSetList).
        end.
    end.
end.

/* ================================================================= */
/* Validate and commit.                                              */
/* ================================================================= */
<M-3 run ValidateBC  (output viFcReturnSuper (oiReturnStatus)) in BDomain>
if viFcReturnSuper <> 0
then oiReturnStatus = viFcReturnSuper.
if viFcReturnSuper < 0
then return.

<M-4 run AdditionalUpdates  (output viFcReturnSuper (oiReturnStatus)) in BDomain>
if viFcReturnSuper <> 0
then oiReturnStatus = viFcReturnSuper.
if viFcReturnSuper < 0
then return.

<M-5 run DataSave  (output viFcReturnSuper (oiReturnStatus)) in BDomain>
if viFcReturnSuper <> 0
then oiReturnStatus = viFcReturnSuper.
if viFcReturnSuper < 0
then return.