This post is subsequent of the previous post, which is about error detecting in Alteryx. This is based on the same use case of the previous post.
Use case
The input data is as following transaction.
And use this product master file.
When you want to summarize the transaction data, join both two data with ProductID as key and multiply the Unit Price and Qty.
The check point which you have to check is L anchor of the Join tool because if some data is unregistered for the Product Master, it will be output at the L anchor.
Error detecting by the Message tool
In this post, I would like to use the Message tool to detect the erros. It is also located at the Developer category.
The setting of the Message tool is as follows.
In this case, you need to set as follows.
The default setting of the Message tool just show the message literaly, but you change the Message Type to “Error”, it shows the message as an error. And you can modify the message contents which you like, you can contain the specific error according to the real data contents to the message.
In the sample workflow, the product id which is not registered is shown as an error, so you can know what is missing after the workflow running. And the option “When To Send Message” is set as “True”, all records coming into the Message tool are shown as errors.
If you actually run the workflow with insufficient Product Master, you will get the following errors.
For this, you can know that the Product ID 4 and 5 is not registered for the Product Master.
Error detection logic of the Message tool
You can not do the error detection like comparing the value of the multi data streams such as the Test tool, but if you use some tools and join the value, you can do the similar check as the Test tool. The Message tool is flexible than the Test tool, but you have to make a logic for error detecting by yourself. The Test tool provide the tipical test case, so you can use it easily, but if it is not enough for you, you should use the Message tool.
In particular, if you want to contain the field value to the error message, you have to use the Message tool. This is recommended because it is become to easy to use the workflow. If there are any errors, you can just see the message and it will be easier to deal with.
“When To Send Message” option
The options “Before First Record”, “After Last Record” an “After All Down Stream Tools Have Completed” are that the Message tool show only one error message even if there are many errors. The difference is only the timing when the errors are shown. And using these options the Message tool shows no message when there is no records. So, you can use these options if there is only one records at least Therefore, these options can be used if you want to detect an error as long as there is at least one record (in that case, any option can be used, but the option that shows the error the earliest way is “Before First Record” option.) However, this option cannot be used if you want to determine whether an error is present for each record.
On the other hand, regarding to the “Before Rows Where Expression is True” option, you can check the all records by the formula which you set whether there is an error or not. Of course, the Message tool shows the error when the record only have an error. In other words, the Message tool will only output a message if the condition is met. If you always want to output the message, you can set it as “True”. Anyway, the advantage of this option “Before Rows Where Expression is True” is that it can detect whether or not there is an error for each record.
Conclusion
- I introduced how to detect the error by the Message tool
- The Message tools is more flexible than the Test tool, but doing the multiple error detection method at the Message tool is very difficut to do.
- You can test :
- If even one record is found, it is considered an error.
- Set error conditions to detect errors.
- This kind of the automatic error detection makes the management of the workflow easier.
- If you want to do the error detection ealisy, I recommend you to use the Test tool.
- In addition to detecting errors, this tool can also detect what is happening in your workflow.
Sample workflow download
The next blog post is…
The next blog is about error detection by Designer, too.
コメント