project BLF > class BReportRequest > method ValidateComponent
Description
Write here all tests on database update (new / modify / delete) that cannot be coded with a validation mask.
The type of update can be found in tc_status (N/C/D).
If you find incorrect data, you must write an entry in tFcMessages (using SetMessage) and set the return status of this method to either +1 or -1.
Return status +1 = data will still be accepted.
Return status -1 = data will not be accepted.
This method is run from SetPublicTables, before transferring the received data into the class temp-tables.
Parameters
| oiReturnStatus | output | integer | |
Internal usage
unused
program code (program/breportrequest.p)
<ANCESTOR-CODE>
/* Give a warning if the report daemon isn't active */
assign vhFcComponent = ?.
<M-5 run ApiDaemonIsRunning
(output viNumberOfInstances (oiNumberOfInstances),
output viFcReturnSuper (oiReturnStatus)) in BReportDaemon>
if viFcReturnSuper < 0 or
oiReturnStatus = 0
then assign oiReturnStatus = viFcReturnSuper.
if viNumberOfInstances = ? or
viNumberOfInstances <= 0
then do:
<M-6 run SetMessage
(input trim(#T-5'The report will only be processed when the report service is started/active.':255(825521573)T-5#) (icMessage),
input '':U (icArguments),
input '':U (icFieldName),
input '':U (icFieldValue),
input 'W':U (icType),
input 4 (iiSeverity),
input '':U (icRowid),
input 'BLF-146':U (icFcMsgNumber),
input '':U (icFcExplanation),
input '':U (icFcIdentification),
input '':U (icFcContext),
output viFcReturnSuper (oiReturnStatus)) in BReportRequest>
if oiReturnStatus = 0
then assign oiReturnStatus = 1.
end.
/* report name is mandatory */
for each t_sRptRequest where
(t_sRptRequest.tc_Status = "N" or
t_sRptRequest.tc_Status = "C") and
(t_sRptRequest.tcBusComponentCode = "" or
t_sRptRequest.tcBusComponentCode = ? or
t_sRptRequest.tcBusActivityCode = "" or
t_sRptRequest.tcBusActivityCode = ?) on error undo, throw:
<M-1 run SetMessage
(input #T-1'Report name is mandatory.':255(9212)T-1# (icMessage),
input '' (icArguments),
input 'tRptRequest.tcBusActivityCode' (icFieldName),
input t_sRptRequest.tcBusActivityCode (icFieldValue),
input 'E' (icType),
input 3 (iiSeverity),
input t_sRptRequest.tc_Rowid (icRowid),
input 'BLF-144':U (icFcMsgNumber),
input '' (icFcExplanation),
input '' (icFcIdentification),
input '' (icFcContext),
output viFcReturnSuper (oiReturnStatus)) in BReportRequest>
oiReturnStatus = -1.
end.
/* at least one destination needs to be specified for the report request */
for each t_sRptRequest where
t_sRptRequest.tc_Status = "N" on error undo, throw:
if (t_sRptRequest.RptPrinter_ID = ? or t_sRptRequest.RptPrinter_ID = 0) and
(t_sRptRequest.RptRequestSaveFileName = ? or t_sRptRequest.RptRequestSaveFileName = "") and
((t_sRptRequest.RptRequestMailTo = ? or t_sRptRequest.RptRequestMailTo = "") and
(t_sRptRequest.RptRequestMailCc = ? or t_sRptRequest.RptRequestMailCc = "") and
(t_sRptRequest.RptRequestMailBcc = ? or t_sRptRequest.RptRequestMailBcc = "")) and
not can-find (first t_sRptRequestMail where
t_sRptRequestMail.tc_ParentRowid = t_sRptRequest.tc_Rowid and
t_sRptRequestMail.tc_Status <> "D")
then do:
<M-2 run SetMessage
(input #T-3'You must specify the output destination of the report.':100(9231)T-3# (icMessage),
input '' (icArguments),
input '' (icFieldName),
input '' (icFieldValue),
input 'E' (icType),
input 3 (iiSeverity),
input t_sRptRequest.tc_Rowid (icRowid),
input 'BLF-145':U (icFcMsgNumber),
input '' (icFcExplanation),
input '' (icFcIdentification),
input '' (icFcContext),
output viFcReturnSuper (oiReturnStatus)) in BReportRequest>
oiReturnStatus = -1.
end.
end.