| opPrimeKey | output | longchar | Primary Key field value of loaded record(s). Keys are chr(4) separated. Key fields are chr(2) separated. |
| oiReturnStatus | output | integer | Return status of the method. |
/* First, make sure the BusActivity_ID and ControlPropertyLayerValue fields are filled in correctly */
for each t_sControlProperty on error undo, throw:
if t_sControlProperty.tcBusComponentCode = ""
or t_sControlProperty.tcBusComponentCode = ?
or t_sControlProperty.tcBusActivityCode = ""
or t_sControlProperty.tcBusActivityCode = ?
then do:
vlWarned = yes.
<M-24 run SetMessage
(input #T-52'Some customizations were skipped.':255(126284260)T-52# (icMessage),
input '' (icArguments),
input 'tControlProperty.tcBusActivityCode' (icFieldName),
input t_sControlProperty.tcBusComponentCode + '.' + t_sControlProperty.tcBusActivityCode (icFieldValue),
input 'W' (icType),
input 4 (iiSeverity),
input t_sControlProperty.tc_Rowid (icRowid),
input 'blf-741712':U (icFcMsgNumber),
input '' (icFcExplanation),
input 'rowid=' + t_sControlProperty.tc_Rowid (icFcIdentification),
input 'form=' + t_sControlProperty.controlPropertyWindow (icFcContext),
output viFcReturnSuper (oiReturnStatus)) in BControlProperty>
for each t_sControlPropertySegment where
t_sControlPropertySegment.tc_ParentRowid = t_sControlProperty.tc_Rowid
on error undo, throw:
delete t_sControlPropertySegment.
end.
delete t_sControlProperty.
next.
end.
<Q-2 run BusActivityPrim (all) (Read) (Cache)
(input ?, (BusActivityID)
input t_sControlProperty.tcBusActivityCode, (BusActivityCode)
input t_sControlProperty.tcBusComponentCode, (BusComponentCode)
output dataset tqBusActivityPrim) in BBusinessComponent >
find first tqBusActivityPrim where
tqBusActivityPrim.tcBusComponentCode = t_sControlProperty.tcBusComponentCode and
tqBusActivityPrim.tcBusActivityCode = t_sControlProperty.tcBusActivityCode
no-error.
if not available tqBusActivityPrim
then do:
vlWarned = yes.
<M-58 run SetMessage
(input #T-31'Some customizations were skipped.':255(126284260)T-31# (icMessage),
input '' (icArguments),
input 'tControlProperty.tcBusActivityCode' (icFieldName),
input t_sControlProperty.tcBusComponentCode + '.' + t_sControlProperty.tcBusActivityCode (icFieldValue),
input 'W' (icType),
input 4 (iiSeverity),
input t_sControlProperty.tc_Rowid (icRowid),
input 'blf-26198':U (icFcMsgNumber),
input '' (icFcExplanation),
input 'rowid=' + t_sControlProperty.tc_Rowid (icFcIdentification),
input 'form=' + t_sControlProperty.controlPropertyWindow (icFcContext),
output viFcReturnSuper (oiReturnStatus)) in BControlProperty>
for each t_sControlPropertySegment where
t_sControlPropertySegment.tc_ParentRowid = t_sControlProperty.tc_Rowid
on error undo, throw:
delete t_sControlPropertySegment.
end.
delete t_sControlProperty.
next.
end.
assign t_sControlProperty.BusActivity_ID = tqBusActivityPrim.tiBusActivity_ID
t_sControlProperty.ControlPropertyLayerValue = 0.
case t_sControlProperty.ControlPropertyLayerType:
when {&CONTROLPROPERTYLAYERTYPE-ROLE}
then do:
if t_sControlProperty.tcRoleName = ""
then do:
vlWarned = yes.
<M-30 run SetMessage
(input #T-64'Some customizations were skipped.':255(126284260)T-64# (icMessage),
input '' (icArguments),
input 'tControlProperty.tcRoleName' (icFieldName),
input t_sControlProperty.tcRoleName (icFieldValue),
input 'W' (icType),
input 4 (iiSeverity),
input t_sControlProperty.tc_Rowid (icRowid),
input 'blf-679614':U (icFcMsgNumber),
input '' (icFcExplanation),
input 'rowid=' + t_sControlProperty.tc_Rowid (icFcIdentification),
input 'form=' + t_sControlProperty.controlPropertyWindow (icFcContext),
output viFcReturnSuper (oiReturnStatus)) in BControlProperty>
for each t_sControlPropertySegment where
t_sControlPropertySegment.tc_ParentRowid = t_sControlProperty.tc_Rowid
on error undo, throw:
delete t_sControlPropertySegment.
end.
delete t_sControlProperty.
next.
end.
<Q-38 run RolePrim (all) (Read) (Cache)
(input ?, (RoleID)
input t_sControlProperty.tcRoleName, (RoleName)
output dataset tqRolePrim) in BRole >
find first tqRolePrim where
tqRolePrim.tcRoleName = t_sControlProperty.tcRoleName
no-error.
if not available tqRolePrim
then do:
vlWarned = yes.
<M-42 run SetMessage
(input #T-26'Some customizations were skipped.':255(126284260)T-26# (icMessage),
input '' (icArguments),
input 'tControlProperty.tcRoleName' (icFieldName),
input t_sControlProperty.tcRoleName (icFieldValue),
input 'W' (icType),
input 4 (iiSeverity),
input t_sControlProperty.tc_Rowid (icRowid),
input 'blf-191976':U (icFcMsgNumber),
input '' (icFcExplanation),
input 'rowid=' + t_sControlProperty.tc_Rowid (icFcIdentification),
input 'form=' + t_sControlProperty.controlPropertyWindow (icFcContext),
output viFcReturnSuper (oiReturnStatus)) in BControlProperty>
for each t_sControlPropertySegment where
t_sControlPropertySegment.tc_ParentRowid = t_sControlProperty.tc_Rowid
on error undo, throw:
delete t_sControlPropertySegment.
end.
delete t_sControlProperty.
next.
end.
assign t_sControlProperty.ControlPropertyLayerValue = tqRolePrim.tiRole_ID.
end.
when {&CONTROLPROPERTYLAYERTYPE-USER}
then do:
if t_sControlProperty.tcUsrLogin = ""
then do:
vlWarned = yes.
<M-55 run SetMessage
(input #T-18'Some customizations were skipped.':255(126284260)T-18# (icMessage),
input '' (icArguments),
input 'tControlProperty.tcusrLogin' (icFieldName),
input t_sControlProperty.tcUsrLogin (icFieldValue),
input 'W' (icType),
input 4 (iiSeverity),
input t_sControlProperty.tc_Rowid (icRowid),
input 'blf-84573':U (icFcMsgNumber),
input '' (icFcExplanation),
input 'rowid=' + t_sControlProperty.tc_Rowid (icFcIdentification),
input 'form=' + t_sControlProperty.controlPropertyWindow (icFcContext),
output viFcReturnSuper (oiReturnStatus)) in BControlProperty>
for each t_sControlPropertySegment where
t_sControlPropertySegment.tc_ParentRowid = t_sControlProperty.tc_Rowid
on error undo, throw:
delete t_sControlPropertySegment.
end.
delete t_sControlProperty.
next.
end.
<Q-84 run UserPrim (all) (Read) (Cache)
(input ?, (UsrId)
input t_sControlProperty.tcUsrLogin, (UsrLogin)
output dataset tqUserPrim) in BUser >
find first tqUserPrim where
tqUserPrim.tcUsrLogin = t_sControlProperty.tcUsrLogin
no-error.
if not available tqUserPrim
then do:
vlWarned = yes.
<M-34 run SetMessage
(input #T-93'Some customizations were skipped.':255(126284260)T-93# (icMessage),
input '' (icArguments),
input 'tControlProperty.tcusrLogin' (icFieldName),
input t_sControlProperty.tcUsrLogin (icFieldValue),
input 'W' (icType),
input 4 (iiSeverity),
input t_sControlProperty.tc_Rowid (icRowid),
input 'blf-541540':U (icFcMsgNumber),
input '' (icFcExplanation),
input 'rowid=' + t_sControlProperty.tc_Rowid (icFcIdentification),
input 'form=' + t_sControlProperty.controlPropertyWindow (icFcContext),
output viFcReturnSuper (oiReturnStatus)) in BControlProperty>
for each t_sControlPropertySegment where
t_sControlPropertySegment.tc_ParentRowid = t_sControlProperty.tc_Rowid
on error undo, throw:
delete t_sControlPropertySegment.
end.
delete t_sControlProperty.
next.
end.
assign t_sControlProperty.ControlPropertyLayerValue = tqUserPrim.tiUsr_ID.
end.
end case.
end.
/* Now, start the real processing */
for each t_sControlProperty
break by t_sControlProperty.BusActivity_ID
by t_sControlProperty.ControlPropertyWindow
by t_sControlProperty.ControlPropertyLayerType
by t_sControlProperty.ControlPropertyLayerValue
on error undo, throw:
if first-of(t_sControlProperty.ControlPropertyLayerValue)
then do:
assign vcFreeForm = "for each ControlProperty where " +
"ControlProperty.BusActivity_ID = " + string(t_sControlProperty.BusActivity_ID) + " and " +
"ControlProperty.ControlPropertyWindow = '" + t_sControlProperty.ControlPropertyWindow + "' and " +
"ControlProperty.ControlPropertyLayerType = " + string(t_sControlProperty.ControlPropertyLayerType) + " and " +
"ControlProperty.ControlPropertyLayerValue = " + string(t_sControlProperty.ControlPropertyLayerValue).
<M-81 run DataLoad
(input '' (icRowids),
input '' (icPkeys),
input '' (icObjectIds),
input vcFreeForm (icFreeform),
input true (ilKeepPrevious),
output viFcReturnSuper (oiReturnStatus)) in BControlProperty>
if viFcReturnSuper = -4
then assign viFcReturnSuper = 0.
if viFcReturnSuper < 0 or
oiReturnStatus = 0
then assign oiReturnStatus = viFcReturnSuper.
if oiReturnStatus < 0
then return.
for each tControlProperty where
tControlProperty.BusActivity_ID = t_sControlProperty.BusActivity_ID and
tControlProperty.ControlPropertyWindow = t_sControlProperty.ControlPropertyWindow and
tControlProperty.ControlPropertyLayerType = t_sControlProperty.ControlPropertyLayerType and
tControlProperty.ControlPropertyLayerValue = t_sControlProperty.ControlPropertyLayerValue
on error undo, throw:
assign tControlProperty.tc_Status = "D".
end.
end.
/* Lookup object by logical key. When in create mode, skip lookup. */
if vcActivityCode = "Create"
then release tControlProperty.
else find tControlProperty where
tControlProperty.BusActivity_ID = t_sControlProperty.BusActivity_ID and
tControlProperty.ControlPropertyWindow = t_sControlProperty.ControlPropertyWindow and
tControlProperty.ControlPropertyLayerType = t_sControlProperty.ControlPropertyLayerType and
tControlProperty.ControlPropertyLayerValue = t_sControlProperty.ControlPropertyLayerValue and
tControlProperty.ControlPropertyControl = t_sControlProperty.ControlPropertyControl and
tControlProperty.ControlPropertyName = t_sControlProperty.ControlPropertyName
no-error.
/* When in delete mode, ignore input data. When object not found, do not return an error. */
if vcActivityCode = "Delete"
then do:
/* Update input to allow correct matching */
if available tControlProperty
then assign t_sControlProperty.tc_ParentRowid = ""
t_sControlProperty.tc_Rowid = tControlProperty.tc_Rowid
t_sControlProperty.tc_Status = "D".
else delete t_sControlProperty.
next.
end.
if vcActivityCode = "Create" or
not available tControlProperty
then do:
/* When object not found and in modify only mode, return an error */
if vcActivityCode = "Modify"
then do:
<M-5 run SetMessage
(input trim(#T-1'Object with key $1 does not exist.':100(8887)T-1#) (icMessage),
input string(t_sControlProperty.BusActivity_ID) + ',' + t_sControlProperty.ControlPropertyWindow + ',' + string(t_sControlProperty.ControlPropertyLayerType) + ',' + string(t_sControlProperty.ControlPropertyLayerValue) (icArguments),
input '' (icFieldName),
input '' (icFieldValue),
input 'E' (icType),
input 3 (iiSeverity),
input t_sControlProperty.tc_Rowid (icRowid),
input 'BLF-53':U (icFcMsgNumber),
input '' (icFcExplanation),
input '' (icFcIdentification),
input '' (icFcContext),
output viFcReturnSuper (oiReturnStatus)) in BControlProperty>
assign oiReturnStatus = -1.
return.
end.
/* When object not found or in create mode, create it */
<M-6 run AddDetailLine
(input 'ControlProperty' (icTable),
input '' (icParentRowid),
output viFcReturnSuper (oiReturnStatus)) in BControlProperty>
if viFcReturnSuper < 0 or
oiReturnStatus = 0
then assign oiReturnStatus = viFcReturnSuper.
if oiReturnStatus < 0
then return.
/* Update input to allow correct matching */
assign t_sControlProperty.tc_Status = "N".
end.
else assign tControlProperty.tc_Status = "C"
t_sControlProperty.tc_Status = "C".
/* Delete existing detail */
for each tControlPropertySegment where
tControlPropertySegment.tc_ParentRowid = tControlProperty.tc_Rowid
on error undo, throw:
assign tControlPropertySegment.tc_Status = "D".
end.
/* Update / add detail - basically always in add mode!! */
for each t_sControlPropertySegment where
t_sControlPropertySegment.tc_ParentRowid = t_sControlProperty.tc_Rowid
on error undo, throw:
<M-7 run AddDetailLine
(input 'ControlPropertySegment' (icTable),
input tControlProperty.tc_Rowid (icParentRowid),
output viFcReturnSuper (oiReturnStatus)) in BControlProperty>
if viFcReturnSuper < 0 or
oiReturnStatus = 0
then assign oiReturnStatus = viFcReturnSuper.
if oiReturnStatus < 0
then return.
assign t_sControlPropertySegment.tc_Status = "N"
t_sControlPropertySegment.ControlProperty_ID = tControlPropertySegment.ControlProperty_ID
t_sControlPropertySegment.tc_Rowid = tControlPropertySegment.tc_Rowid
t_sControlPropertySegment.tc_ParentRowid = tControlProperty.tc_Rowid.
end.
/* Override value for identity fields in input */
assign t_sControlProperty.ControlProperty_ID = tControlProperty.ControlProperty_ID
t_sControlProperty.tc_Rowid = tControlProperty.tc_Rowid
t_sControlProperty.tc_ParentRowid = "".
vlImportFound = yes.
end.
finally:
if oiReturnStatus = 0
then if vlImportFound = no
then do:
<M-29 run SetMessage
(input #T-36'Nothing was imported.':255(333576403)T-36# (icMessage),
input '' (icArguments),
input '' (icFieldName),
input '' (icFieldValue),
input 'E' (icType),
input 3 (iiSeverity),
input '' (icRowid),
input 'blf-403740':U (icFcMsgNumber),
input '' (icFcExplanation),
input '' (icFcIdentification),
input '' (icFcContext),
output viFcReturnSuper (oiReturnStatus)) in BControlProperty>
oiReturnStatus = -3.
end.
else if vlWarned
then oiReturnStatus = 1.
end finally.