project QadFinancials > class BDomain > method UpdateSharedSet
Description
This method updates shared set for domain.
Parameters
tDomainUpdateSharedSet | input | temp-table | |
ilIsValSharedSetChangeActive | input | logical | This input parameter can be used to deactivate reference validations when domain's shared set is changed. These validations are implemented in the BDomain.ValidateComponentSharedSetChange |
oiReturnStatus | output | integer | Return status of the method. |
Internal usage
QadFinancials
program code (program6/bdomain.p)
/* =================================================================================================== */
/* Method : UpdateSharedSet */
/* Desc : This instance less method updates shared set for domains. List of new shared sets */
/* is passed in temporary table */
/* --------------------------------------------------------------------------------------------------- */
/* Params: (I) DomainUpdateSharedSet Temporary table with list of domains and shared sets to be */
/* updated */
/* DomainID ID of domain for which new shared set should be assign */
/* SharedSetType Type of shared set to be assigned */
/* NewSharedSetId ID of new shared set to be assigned */
/* (I) IsActiveReferenceVal Flag which activates/deactivates validations of the change of */
/* the shared set */
/* =================================================================================================== */
assign oiReturnStatus = -98
vlIsValSharedSetChangeActive = ilIsValSharedSetChangeActive.
/* =================================================================================================== */
/* Validate input parameters */
/* =================================================================================================== */
if not can-find(first tDomainUpdateSharedSet)
then do:
assign oiReturnStatus = 0.
return.
end.
/* =================================================================================================== */
/* Load all domains for which new shared set should be assigned */
/* =================================================================================================== */
<M-8 run ClearData
(output viFcReturnSuper (oiReturnStatus)) in BDomain>
if viFcReturnSuper <> 0 then assign oiReturnStatus = viFcReturnSuper.
if viFcReturnSuper < 0 then return.
/* Create list of comma separated IDs */
assign vcDomainIdList = '':U.
for each tDomainUpdateSharedSet
break by tDomainUpdateSharedSet.tiDomainID:
if first-of(tDomainUpdateSharedSet.tiDomainID)
then if vcDomainIdList = '':U
then vcDomainIdList = string(tDomainUpdateSharedSet.tiDomainID).
else vcDomainIdList = vcDomainIdList + ',':U + string(tDomainUpdateSharedSet.tiDomainID).
end.
<M-2 run DataLoad
(input ? (icRowids),
input ? (icPkeys),
input vcDomainIdList (icObjectIds),
input ? (icFreeform),
input false (ilKeepPrevious),
output viFcReturnSuper (oiReturnStatus)) in BDomain>
if viFcReturnSuper <> 0 then assign oiReturnStatus = viFcReturnSuper.
if viFcReturnSuper < 0 then return.
/* =================================================================================================== */
/* Assign new shared set */
/* =================================================================================================== */
for each tDomainUpdateSharedSet:
find tDomainSharedSet where
tDomainSharedSet.Domain_ID = tDomainUpdateSharedSet.tiDomainID and
tDomainSharedSet.tcSharedSetTypeCode = tDomainUpdateSharedSet.tcSharedSetType no-error.
if not available tDomainSharedSet
then do:
assign vcMessage = #T-3'Cannot find definition of the shared set of type &1 for domain with ID &2.':255(63866)t-3#
vcMessage = substitute( vcMessage, tDomainUpdateSharedSet.tiDomainID, tDomainUpdateSharedSet.tcSharedSetType)
vcContext = 'Domain_ID=&1|SharedSetTypeCode-&2':U
vcContext = substitute( vcContext, tDomainUpdateSharedSet.tiDomainID, tDomainUpdateSharedSet.tcSharedSetType)
vcContext = replace(vcContext, '|':U, chr(2)).
<M-4 run SetMessage
(input vcMessage (icMessage),
input '':U (icArguments),
input '':U (icFieldName),
input '':U (icFieldValue),
input 'S':U (icType),
input 3 (iiSeverity),
input '':U (icRowid),
input 'QadFin-6606':U (icFcMsgNumber),
input '':U (icFcExplanation),
input '':U (icFcIdentification),
input vcContext (icFcContext),
output viFcReturnSuper (oiReturnStatus)) in BDomain>
assign oiReturnStatus = -1.
return.
end.
<Q-9 run SharedSetPrim (all) (Read) (NoCache)
(input tDomainUpdateSharedSet.tiNewSharedSetId, (SharedSetID)
input ?, (SharedSetCode)
output dataset tqSharedSetPrim) in BSharedSet >
find tqSharedSetPrim where
tqSharedSetPrim.tiSharedSet_ID = tDomainUpdateSharedSet.tiNewSharedSetId no-error.
if not available tDomainUpdateSharedSet
then do:
assign vcMessage = #T-11'Cannot read definition of shared set.':255(64268)T-11#
vcContext = 'tDomainUpdateSharedSet.tiNewSharedSetId=&1':U
vcContext = substitute(vcContext, tDomainUpdateSharedSet.tiNewSharedSetId).
<M-10 run SetMessage
(input vcMessage (icMessage),
input '':U (icArguments),
input '':U (icFieldName),
input '':U (icFieldValue),
input 'S':U (icType),
input 3 (iiSeverity),
input '':U (icRowid),
input 'QadFin-6757':U (icFcMsgNumber),
input '':U (icFcExplanation),
input '':U (icFcIdentification),
input vcContext (icFcContext),
output viFcReturnSuper (oiReturnStatus)) in BDomain>
assign oiReturnStatus = -1.
return.
end.
assign tDomainSharedSet.SharedSet_ID = tqSharedSetPrim.tiSharedSet_ID
tDomainSharedSet.tcSharedSetCode = tqSharedSetPrim.tcSharedSetCode
tDomainSharedSet.tc_Status = (if tDomainSharedSet.tc_Status = '':U
then 'C':U
else tDomainSharedSet.tc_Status).
end.
/* =================================================================================================== */
/* Return */
/* =================================================================================================== */
if oiReturnStatus = -98 then assign oiReturnStatus = 0.