Validate Electronic Reporting on execution and show errors or warnings

During execution, we may want to check for certain validations. If these validations fail, we can show a warning or an error that stops the process. With ER, we already have a built-in interface for this.

We can add validations in the mapping for exports and imports:

On the format for exports:

And on the format mapping for imports:

I’m going to work on an export format that simply has a list of customers and a field with their account numbers.

Let’s create a condition where the account cannot be US-002.

In the format, we select the field where we want the condition to be evaluated. We then follow these steps:

  • Select the ‘Validation’ tab.
  • Click ‘New’ to create a new validation.
  • Define the ‘Condition’ and the ‘Message’.
  • Choose the type of error or warning we want to display.
The condition
The message, is better to use translated labels
The kind of error

Now when executing the format we get:
Validation error(s) occured during ‘Format mapping’ run.
Evaluating binding of format component File/NewLine/Records.
This Customer is not valid

Post Validation Action

We have three options for this field:

  • Stop execution (raise an error): It returns an error, and the file won’t be created.
  • Continue execution (write a remark): It’s a warning, so the file will be created.
  • Continue execution (raise an error) stopping finally: It returns an error at the end of the execution, and the file won’t be created.

The difference between “Stop Execution” and “Continue Execution” is that the first will stop immediately when it finds the error, while the latter will stop at the end, showing all errors.

For example, let’s try with a new formula:

AND(@.String <> "US-002", @.String <> "US-001")

And a more descriptive message:

@"GER_LABEL:NoValidCustomer" & ": " & @.String

When running it first for “Stop Execution” and then for “Continue Execution,” we get:

Write a log

There is a final enum with the following options:

  • To user Infolog
  • To execution log table
  • To both locations
  • None

Sadly, I wasn’t able to find any difference between any of those options. I thought the Infolog was just the error/warning message on top of the screen, but I always get it, no matter which option I have selected.

So, when I figure it out, I’m going to modify this post. If you know the differences, please write a comment!


Posted

in

,

by

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *