How to use Process Reports

  • KM322978
  • 28-Dec-2007
  • 28-Dec-2007

Summary

The 'Success' flag by itself is not sufficient to know if processing is successful. What needs to be checked is the ErrorNumber element, along with the Success flag in order to get a complete picture of the processing status.

Question

I have tried to use the 'Success' flag element in the Process Report to find errors in rejected documents, but the flag is always set to 1 (true).
How can 'Success' be true if the document was rejected?

Answer

General

It is important to understand that there is a difference between the processing of a document itself, and the processing of the data contained within that document.

Success Flag

There seems to be some confusion regarding the ‘Success’ flag.  The Success flag alone does not indicate error free processing of data in the target connector. It only reflects that Connect-It was able to produce and consume documents successfully. . That is, if the connector can successfuly produce or consume a document, the flag willl be set to 1 (true). This only indicates that Connect-It had no problems internally (e.g. documents were well-formed, complete, and had no syntax errors or invalid content).

ErrorNumber and WarningNumber

Processing errors resulting from validations or other requirements imposed by the target connector (or even mapping connector) require that you check additional elements such as the ErrorNumber and WarningNumber in the Process Reports. These elements need to be manually added to your Produced document type for the connectors that produce Process Reports. The ErrorNumber and WarningNumber elements will indicate the number of errors and warnings respectively. The value of these elements is not a code to look up in an error list, but rather a count that indicates the number of errors (or warning) that occurred during the processing of the current document.

What needs to be checked (at a minimum) is the ErrorNumber element, along with the Success flag in order to get a complete picture of the processing status. You can see an example of this in the Connect-It User's Guide. ErrorNumber together with the Success flag will identify documents that did not process successfully. There are some situations in which the Success flag may be set to zero even though the document may appear to have been successfully consumed by a connector. For example Connect-It may detect that a document will not be successfully processed if it fails reconciliation. That is, if a reconcilition type is set to Update Only (error if not found), and the option is set to "Reject in case of error", then if the document is not found at the destination, it is going to be rejected before ever being sent to the target connector. As Connect-It already knows the document is to be rejected, this is considered an error condition, and the Success flag will be set to zero (false). However, the Success flag should never be used alone to determine the status of processing.

There is currently no way to know the difference between failure at subdocument level and at the main document level because in either case, ErrorNumber will be > 0 and it is most likely that the Success flag will still be = 1 since the connector was able to consume the document. The only choice at this point is to add code to check the ErrorNumber, and report the error if it is > 0 or if Success = 0 because either indicates an error that should be investigated.

An example how to add a script on the Success element in the Feedback mapping to test the result of processing and set the 'Success' flag accordingly would be:

1.  Add the 'ErrorNumber' element to your Process Reports documents.
2.  In your mappings for the Process Reports, add code to check the 'ErrorNumber' element. For example, at the 'Success' element:

If [Success] = 1 and ErrorNumber = 0 Then
  Retval = 1
Else
  Retval = 0
End If

This will set the 'Success' flag to reflect the true status of processing.

For a document that you want to ignore in the mapping, you will need to make a further determination as to its disposition. In most cases, a Feedback mapping script  from the Mapping Box Process Reports usually ignores a Success flag=1 (because this is the normal result). However, a a Success flag=1will also be set when ignoring a document. In such cases it may be advisable to pass a message along when ignoring the document (an option in the PifIgnoreDocumentMapping function), after which one can look in the Logs collection for that message. Alternatively, one could use the PifLogWarningMessage function, and then check for WarningNumber in the Process Report (after adding the WarningNumber element to the process reports document of course). In this way you can differentiate between documents that were processed successfully by the mapping, and those ignored by the mapping for a qualified reason.