project BLF > class BDomain > method Calculate
Description
Add code here to initialize the calculated fields of the class temp-tables after loading existing records from the application database.
Parameters
oiReturnStatus | output | integer | |
Internal usage
unused
program code (program/bdomain.p)
<ANCESTOR-CODE>
assign vcListSharedSetTypeCode = <M-6 GetSharedSetTypes () in BDomain>.
for each tDomains on error undo, throw:
if vlDataLoadKeepPrevious and can-find (tAlreadyCalculatedRecords where
tAlreadyCalculatedRecords.tcTableName = "Domains" and
tAlreadyCalculatedRecords.tc_Rowid = tDomains.tc_Rowid)
then next.
/* ============================ */
/* Domain SharedSet properties */
/* ============================ */
for each tDomainSharedSet on error undo, throw:
<Q-5 run SharedSetByIDCodeType (all) (Read) (NoCache)
(input '':U, (SharedSetCode)
input ?, (SharedSetIsActive)
input '':U, (SharedSetTypeCode)
input tDomainSharedSet.SharedSet_ID, (SharedSetID)
output dataset tqSharedSetByIDCodeType) in BSharedSet >
find tqSharedSetByIDCodeType where
tqSharedSetByIDCodeType.tiSharedSet_ID = tDomainSharedSet.SharedSet_ID
no-error.
if available tqSharedSetByIDCodeType
then do:
assign tDomainSharedSet.tcSharedSetCode = tqSharedSetByIDCodeType.tcSharedSetCode
tDomainSharedSet.tcSharedSetTypeCode = tqSharedSetByIDCodeType.tcSharedSetTypeCode.
/* retrieve translated string */
assign vcSharedTypeTranslated = "":U.
do viSharedSetCounter = num-entries(vcListSharedSetTypeCode, chr(2)) to 1 by -2:
if entry(viSharedSetCounter, vcListSharedSetTypeCode, chr(2)) = tDomainSharedSet.tcSharedSetTypeCode
then do:
assign tDomainSharedSet.tcSharedSetTypeTranslated = entry(viSharedSetCounter - 1, vcListSharedSetTypeCode, chr(2)).
leave.
end.
end. /* do viIndex = num-entries(vcSharedSetTypeCodes, chr(2)) to 1 by -2: */
end.
end.
/* =================================================== */
/* Domain SharedSet creation */
/* =================================================== */
do viSharedSetCounter = num-entries(vcListSharedSetTypeCode,chr(2)) to 1 by -2 :
if not can-find (first tDomainSharedSet where
tDomainSharedSet.tc_ParentRowid = tDomains.tc_Rowid and
tDomainSharedSet.tc_Status <> "D":U and
tDOmainSharedSet.tcSharedSetTypeCode = entry(viSharedSetCounter,vcListSharedSetTypeCode,chr(2)))
then do :
<M-2 run AddDetailLine (input 'DomainSharedSet':U (icTable),
input tDomains.tc_Rowid (icParentRowid),
output viFcReturnSuper (oiReturnStatus)) in BDomain>
assign tDomainSharedSet.tcSharedSetTypeCode = entry(viSharedSetCounter,vcListSharedSetTypeCode,chr(2))
tDomainSharedSet.tcSharedSetTypeTranslated = entry(viSharedSetCounter - 1, vcListSharedSetTypeCode, chr(2)).
end. /* if not can-find */
end. /* do */
end.