| icTargetField | input | character | Value of the field to validate. |
| icTargetFieldName | input | character | Name of the field to validate. Use the database field name or public data item name. Example : 'Order.Order-Num'. |
| icRowid | input | character | Contents of field tc_Rowid, if the target field is a field of a component temp-table. |
| itEndDate | input | date | End Date or Upper Limit Date |
| iiPeriodYear | input | integer | Year of the period |
| oiReturnStatus | output | integer | Return status of the method. |
QadFinancials
if date(icTargetField) > itEndDate
then do:
assign vcMessage = if icTargetFieldName = "Period.PeriodStartDate":U
then trim(#T-3'The end date (&1) must be after the start date (&2).':255(3082)T-3#)
else trim(#T-4'The Higher Limit Date (&1) must be after the Lower Limit Date (&2).':250(55855)T-4#)
vcMessage = trim(substitute(vcMessage,string(itEndDate),icTargetField))
oiReturnStatus = -1.
<M-1 run SetMessage (input vcMessage (icMessage),
input '':U (icArguments),
input icTargetFieldName (icFieldName),
input icTargetField (icFieldValue),
input 'E':U (icType),
input 3 (iiSeverity),
input icRowid (icRowid),
input 'QADFIN-167':U (icFcMsgNumber),
input '' (icFcExplanation),
input '' (icFcIdentification),
input '' (icFcContext),
output viFcReturnSuper (oiReturnStatus)) in BPeriod>
end.
else do:
if icTargetFieldName = "Period.PeriodStartDate":U
then do:
/* test on leap year(schrikkeljaar) */
if (date("03/01/":U + string(iiPeriodYear,"9999":U)) - 1) = date("02/28/":U + string(iiPeriodYear,"9999":U))
then assign vlError = if (itEndDate - date(icTargetField)) > 365
then true
else false.
else assign vlError = if (itEndDate - date(icTargetField)) > 366
then true
else false.
if vlError
then do:
assign vcMessage = trim(substitute(#T-5'The time between start and end date cannot be more than one year (start date = &1, end date = &2).':255(3084)T-5#,icTargetField,string(itEndDate)))
oiReturnStatus = -1.
<M-2 run SetMessage (input vcMessage (icMessage),
input '':U (icArguments),
input icTargetFieldName (icFieldName),
input icTargetField (icFieldValue),
input 'E':U (icType),
input 3 (iiSeverity),
input icRowid (icRowid),
input 'QADFIN-176':U (icFcMsgNumber),
input '' (icFcExplanation),
input '' (icFcIdentification),
input '' (icFcContext),
output viFcReturnSuper (oiReturnStatus)) in BPeriod>
end.
end.
end.