validation procedure
Description
This method will check if the domaincode is already used in another database. The test is only done when the replication is enabled and when all databases are connected.
Parameters
icTargetField | input | character | Value of the business field to validate. |
icTargetFieldName | input | character | Name of the business field to validate. |
icRowid | input | character | Contents of field tc_Rowid, if the target field is a field of a component temp-table. |
oiReturnStatus | output | integer | Return status of the method. |
Internal usage
BLF
program code (program/bdomain.p)
<ANCESTOR-CODE>
if oiReturnStatus = 0 then
assign oiReturnStatus = -98.
/* ========================================================================== */
/* Check first to see if replication is enabled - replication can be disabled */
/* for conversion routines that need to replicate data from MFG/PRO to */
/* financials. */
/* ========================================================================== */
<I-17 {bFcOpenInstance
&CLASS = "Session"}>
<M-18 run GetLogicalValue
(input 'ReplicationEnabled':U (icName),
output vlReplicationEnabled (olValue),
output viFcReturnSuper (oiReturnStatus)) in Session>
<I-19 {bFcCloseInstance
&CLASS = "Session"}>
if vlReplicationEnabled <> false then do:
/* Check that all databases are connected */
<I-9 {bFcStartAndOpenInstance
&ADD-TO-TRANSACTION = "false"
&CLASS = "BMfgDBConnections"}>
<M-16 run IsMultiDB
(output vlMultiDB (olisMultiDB),
output viFcReturnSuper (oiReturnStatus)) in BMfgDBConnections>
if vlMultiDB then do:
<M-2 run CheckDBConnections
(output viFcReturnSuper (oiReturnStatus)) in BMfgDBConnections>
if viFcReturnSuper < 0 then do:
assign
oiReturnStatus = viFcReturnSuper.
end.
/* Only proceed with the uniqueness check if all the DBs are connected */
else do:
<I-12 {bFcStartAndOpenInstance
&ADD-TO-TRANSACTION = "false"
&CLASS = "PMultiDB"}>
/* Check that the domain code is unique across all MFG/PRO DBs */
<M-6 run validateDomainCodeByParams
(output vlDomainIsValid (olDomainValid),
input icTargetField (icDomainCode),
output viFcReturnSuper (oiReturnStatus)) in PMultiDB>
if not vlDomainIsValid then do:
assign
oiReturnStatus = -1
vcMessage = #T-8'The domain code is primary in another database.':70(57315)T-8#.
<M-7 run SetMessage
(input vcMessage (icMessage),
input '' (icArguments),
input '' (icFieldName),
input '' (icFieldValue),
input 'E':U (icType),
input 3 (iiSeverity),
input '' (icRowid),
input 'QadFin-5849':U (icFcMsgNumber),
input '' (icFcExplanation),
input '' (icFcIdentification),
input '' (icFcContext),
output viFcReturnSuper (oiReturnStatus)) in BDomain>
end.
<I-13 {bFcCloseAndStopInstance
&CLASS = "PMultiDB"}>
end.
end.
<I-15 {bFcCloseAndStopInstance
&CLASS = "BMfgDBConnections"}>
end.
if oiReturnStatus = -98
then
oiReturnStatus = 0.