Tutorials & Examples Web-help Blog

Halt on condition and send email with current file as the attachment


#1

I have an iteration project that passes excel files from a specific folder. The main project contains a Halt on Condition if certain data is missing or invalid.

I want to send a email to the file owner with the current file being processed as the attachment, so they can correct the file and then save back in the folder to be reprocessed.

How can I do this?


#2

There are a few ways how to do it. A few suggestions:

#1

Instead of “Halt on condition”, you can use conditionally derived tables to create IF/ELSE branching.

One branch (when the condition is fulfilled) would send the current file by email to the owner.

The other branch (when the condition is not fulfilled) would continue transformations and return the result to the iteration project.

The downside if this scenario is that the iterating project doesn’t “know” if there were any errors.

#2

Switch the “Iterate” action in the iteration project to the “Collect errors and continue” mode (see below):

image

In this mode, for every file that is failed by the “Halt” action, the error message from the “Halt” action will be shown in a separate column in the output of “Iterate”.

Therefore, it will be possible to filter only the files that failed, and for them run another iteration that would send the files to their owners. Also the iteration project would “know” if anything went wrong.

#3

If you’re using EasyMorph Server, you can ask the file owners to upload files by dropping them into the Server’s web folder (basically drag into the web-browser) and then trigger a pre-validation task (click a button on another web-page of the Server). The pre-validation task would check the data quality and either send the file back to the owner (or show an error message), or move it to the folder with “good” files for further processing.


#3

Hello, thanks for the quick response.

I am using option #2, I created the filter, but I don’t know how to get the files that are left, sent via email as an attachment. I either have to specify a specific file or parameter


#4

After filtering you should have a table with “bad” file names. Just make another iteration across this table and pass the “bad” file names into the iterated project via a parameter. The iterated project would just send an email with the file specified by the parameter attached.

The “Send email” action allows specifying the path to attachment via a parameter.


#5

That worked, thank you so much!!!


#6

You’re welcome!