project BLF > class BCompany > method SynchronizeSharedSet
Description
create defaults for company - shared set references
Parameters
icsharedSetList | input | character | |
oiReturnStatus | output | integer | Return status of the method. |
Internal usage
BLF
program code (program1/bcompany.p)
/* ================================================================= */
/* First load all companys. */
/* ================================================================= */
<M-1 run DataLoad
(input '' (icRowids),
input '' (icPkeys),
input '' (icObjectIds),
input '' (icFreeform),
input no (ilKeepPrevious),
output viFcReturnSuper (oiReturnStatus)) in BCompany>
if viFcReturnSuper = -4
then do:
/* no companys = no updates */
return.
end.
if viFcReturnSuper <> 0
then oiReturnStatus = viFcReturnSuper.
if viFcReturnSuper < 0
then return.
/* ================================================================= */
/* Add the new shared sets. */
/* ================================================================= */
for each bcompany on error undo, throw:
do visco = num-entries(icsharedSetList) to 2 by -2:
find first tcompanySharedSet where
tcompanySharedSet.tc_ParentRowid = bcompany.tc_Rowid and
tcompanySharedSet.tcSharedSetTypeCode = entry(visco - 1,icsharedSetList) no-error.
if available tcompanySharedSet
then do:
if tcompanySharedSet.tc_Status = "N"
then tcompanySharedSet.tcSharedSetCode = entry(visco,icsharedSetList).
end.
else do:
<M-2 run AddDetailLine
(input 'CompanySharedSet' (icTable),
input bcompany.tc_Rowid (icParentRowid),
output viFcReturnSuper (oiReturnStatus)) in BCompany>
if viFcReturnSuper <> 0
then oiReturnStatus = viFcReturnSuper.
if viFcReturnSuper < 0
then return.
assign tcompanySharedSet.tcSharedSetTypeCode = entry(visco - 1,icsharedSetList)
tcompanySharedSet.tcSharedSetCode = entry(visco,icsharedSetList).
end.
end.
end.
/* ================================================================= */
/* Validate and commit. */
/* ================================================================= */
<M-3 run ValidateBC (output viFcReturnSuper (oiReturnStatus)) in BCompany>
if viFcReturnSuper <> 0
then oiReturnStatus = viFcReturnSuper.
if viFcReturnSuper < 0
then return.
<M-4 run AdditionalUpdates (output viFcReturnSuper (oiReturnStatus)) in BCompany>
if viFcReturnSuper <> 0
then oiReturnStatus = viFcReturnSuper.
if viFcReturnSuper < 0
then return.
<M-5 run DataSave (output viFcReturnSuper (oiReturnStatus)) in BCompany>
if viFcReturnSuper <> 0
then oiReturnStatus = viFcReturnSuper.
if viFcReturnSuper < 0
then return.