project BLF > class BWorkObject > method DataLoadByObjectID
Description
Load workobject of parent object ID
Parameters
icBusComponentCode | input | character | BusComponentCode; corresponds with BusComponent.BusComponentCode |
icObjectIdentifiers | input | character | comma seperated list |
oiReturnStatus | output | integer | Return status of the method. |
Internal usage
BLF
program code (program1/bworkobject.p)
/* ==================================================== */
/* Convert the BusComponentCode into the BusComponentID */
/* ==================================================== */
<Q-7 run BusComponentByLabelCodeID (all) (Read) (NoCache)
(input ?, (BusComponentID)
input icBusComponentCode, (BusComponentCode)
input ?, (BusComponentLabel)
output dataset tqBusComponentByLabelCodeID) in BBusinessComponent >
find first tqBusComponentByLabelCodeID where
tqBusComponentByLabelCodeID.tcBusComponentCode = icBusComponentCode
no-lock no-error.
if available tqBusComponentByLabelCodeID
then assign viBusComponentID = tqBusComponentByLabelCodeID.tiBusComponent_ID.
else do :
assign vcMessage = trim(substitute(#T-9'Business class could not be found based on its code (&1).':255(487)T-9#,icBusComponentCode))
oiReturnStatus = -3.
<M-6 run SetMessage
(input vcMessage (icMessage),
input '':U (icArguments),
input '':U (icFieldName),
input '':U (icFieldValue),
input 'E':U (icType),
input 3 (iiSeverity),
input '':U (icRowid),
input 'BLF-275':U (icFcMsgNumber),
input '' (icFcExplanation),
input '' (icFcIdentification),
input '' (icFcContext),
output viFcReturnSuper (oiReturnStatus)) in BWorkObject>
Return.
end. /* if not available tqBusComponentByLabelCodeID */
/* ==================================================== */
/* Load all required instances */
/* ==================================================== */
assign vlKeepPrevious = false.
/* Cycle through iccObjectIdentifiers */
do viCount = 1 to num-entries(icObjectIdentifiers):
/* Only call DataLoad in case the data is not yet in the instance */
assign viWorkObjectInternalID = integer(entry(viCount,icObjectIdentifiers)) no-error.
if error-status:error = false and
not can-find (first tWorkObject where
tWorkObject.BusComponent_ID = viBusComponentID and
tWorkObject.WorkObjectInternal_ID = viWorkObjectInternalID)
then do :
assign vcFreeform = "for each WorkObject where ":U +
"WorkObject.BusComponent_ID = ":U + string(viBusComponentID) + " and ":U +
"WorkObject.WorkObjectInternal_ID = ":U + entry(viCount,icObjectIdentifiers).
<M-8 run DataLoad
(input '' (icRowids),
input '' (icPkeys),
input '' (icObjectIds),
input vcFreeform (icFreeform),
input vlKeepPrevious (ilKeepPrevious),
output oiReturnStatus (oiReturnStatus)) in BWorkObject>
if oiReturnStatus <> 0
then return.
/* Make sure we only clear the instance data the first time we get in here */
assign vlKeepPrevious = true.
end. /* if error-status:error = false and */
end. /* do viCount = 1 to num-entries(icObjectIdentifiers): */