WeeklyAlteryxTips#51 Detecting errors in Alteryx Part4

Alteryx

This post is about detecting the error, which is the last post about it. It’s the error detection of the Analytic App.

How to detect the error in Analytic App?

For example, when entering a postal code, you want it to be in the format “XXX-XXXX”. In this case, you will make the Analytic App as follows.

Considering the previous post, you can make it as follows.

The Message tool’s setting is as follows.

Let’s enter “12345678” as follows.

After run, it shows the error.

You can detect the error by the above method.

Error detecting for the Analytic AppWrite the expression for the error detection here. The result should be either “True” or “False”.

There is one more way to detect the error for the Analytic App. This way is more appropriate for the Analytic App. It is to use the Error Message tool in the Interface category. It is no needed for inserting to the main logic, it is very simple way and no complex things. Keep the error detection for the interface, within the interface.

For example, in this case you can detect the error by the Error Message tool that connects the Text Box tool as follows.

How do you can set the Error Message tool? It is only that you set the Expression and Error Message. This is very simple.

Q input accepts multiple Q outputs. You can use each connects by specifying the connection name which is default [#1], [#2] and so on. In this workflow, I use this REGEX_Match function below.

!REGEX_Match([#1], "d{3}-d{4}")

The beginning of the expression has an exclamatio mark, the result is inverted. In other words, when the result is not matched at the REGEX_Match function, the final result would be “True”. So, if the user does not enter the type like “XXX-XXXX”, the error occurs.

At the part of the “if Expression is true, display error message:”, you can input the message when the expression’s result is true. You don’t have to enclose it in the double quotations, but you can’t dynamically change the message depending on the data.

Let’s run that Analytic App.

Enter like above and click the Finish button, it would show the error below.

It is almost the same as the error which the Message tool shows.

Conclusion

  • I have explained how to use the Error Message tool in the Interface category.
  • The Message tool can show the error, too. But for the Analytic App, the Error Message tool makes the workflow more simple.

Sample Workflow Download

The next blog post is…

Next blog would be about Message tool. I will explain the combination of the Macro and the Message tool.

コメント

Copied title and URL