In part 1 of this series we looked at the case where we didn't have an input hooked up to our control container in the logging container. This time we are going to look at what we can do with the input anchor connected.
How does the Input Anchor work?
We noted in the last post that without an input anchor the control container works very much like the CReW Runner macro. Well if we connect up the input anchor then the control container works very much like the CReW Conditional Runner macro. That is to say:
- If the Input Anchor is disconnected
- All tools inside run as though they were in a regular container (or straight on the canvas)
- If the Input Anchor is connected
- If the input anchor receives 0 records – The tools in the Control Container DO NOT run
- If the input anchor receives >0 records – The tools in the Control Container run AFTER the last input record is received
Or in pictures
Introducing the Container Error Check Macro
With this we now are very close to replacing the CReW Runner macros with Control Containers! All we need is the S and F outputs provided by the runner macros. We replace this with the Container Error Check Macro.
You can download it from:
(To install it copy it into the macros folder where you have the CReW macros installed on your machine. For example C:\CReWMacros\Macros)
You connect it directly after a control container and it has the following behaviour:
- If the incoming log messages contain an error all records get pushed out of F (Fail) output
- If incoming log messages have no errors all records get pushed out of S (Success) output
Anyone who has used the Runner macros will find this very familiar.
Using this macro we can now conditionally run parts of our workflow!
This workflow generates a PDF report and then if there are no errors uploads it via an API using the download tool. If on the other hand there are errors, then the file is not uploaded, but an email is sent instead.
If you are at Inspire today, please come to my breakout session to learn about this use case and more.
If you aren't at Inspire, but would like me to present this talk at your local user group them please get in touch and we can set up a date!
Post a Comment