Engine Works

Under the hood of Alteryx: tips, tricks and how-tos.
TheOC
14 - Magnetar

When building a Macro or Analytic App, it’s easy to fall into the trap of troubleshooting by making a change inside the Macro/App, saving it, and then inspecting the results by running. This can be useful for small changes. However, if you are testing an issue that occurs in the middle of a large workflow, this can be tedious and unclear.

 

via GIPHY

 

I tend to make Macros and Analytic Apps often, and it has become a good habit to rely on a Debug Workflow to help with troubleshooting. I would like to show you through that process.

 

I will first start with an Analytic App, and this is a very simple application to help illustrate how this functionality can be used. The app asks the user to input two numbers to be multiplied together – because math is hard.

 

via GIPHY

 

The Starting Point

 

My Interface Tools are set up with Action Tools to replace the values in the formula. In theory, this should work perfectly fine.

 

1.png

 

However, when I run this as an app and enter values:

 

TheOC_19-1653399447913.png

 

I get the following results:

 

TheOC_20-1653399447924.png

 

Not expected… I would have thought 25 * 2 would be 50… Let’s have a look at the Debug functionality.

 

via GIPHY

 

Steps to Investigate with the Interface Designer

 

Open the Interface Designer by going to View ➡️ Interface Designer. Alternatively, you can use the shortcut Ctrl+Alt+D:


TheOC_21-1653399447933.png

 

Within the Interface Designer, click the second icon – the Test View:


TheOC_22-1653399447945.png

 

Enter the values you want to test on your workflow. In this case, I am going to replicate the issue I had previously, and change the number to multiply to 25, and the number to multiply by 2:


TheOC_23-1653399447949.png

 

Click the ‘Open Debug’ option to the right:


TheOC_24-1653399447967.png

 

This effectively opens the workflow that would run when these options have been supplied within the app. In this case, 25 and 2:


TheOC_25-1653399448002.png
You will notice that it has a Debug Log – showing us the values entered in the Interface Tools. We can also see that it is given a header, and named ‘Debug Workflow’ so that we don’t confuse this with our real workflow. The Interface Tools are also seemingly missing. This is because the workflow has been edited as specified by the values that we have given in the test window. Debug mode also does not change annotations, so the Formula Tool is still labeled ‘Number = 1 * 1’ – however this is not the case.

Hit run and investigate your tools to find the error.


TheOC_26-1653399448056.png
Here I can see that my formula has become ’25 * 25’, and I can see that it’s the Formula Tool that is creating my weird output. Obviously, with larger apps, this becomes increasingly useful with many more Interface Tools.

After finding the error, go back to your original app/Macro, and make the changes required:


TheOC_38-1653400520149.png

 

In this simple case, both instances of ‘1’ were being replaced by my Action Tool, and the first to run was the number to multiply, so the formula became 25 * 25. I have gone back to the app, and changed this to 1*2, so both will not get replaced by the same action tool.


TheOC_27-1653399448069.png


There we go, I found my issue and fixed it!

 

via GIPHY

 

Investigating a Macro For Errors

 

As another example, an issue I often face with Alteryx Macros is the outcome that the internal workflow of the Macro will work fine, but once it is wrapped into a tool and implemented into another workflow it faces an error. This is very similar to Analytic Apps, in that the larger the Macro becomes, the more difficult it can be to troubleshoot without the use of the Debug mode. I created a similar situation with a Macro to help illustrate:

 

TheOC_28-1653399448087.png

 

This provides the same outcome: enter a number in the input, specify what to multiply it by, and receive an output. I have a macro input setup with the following data:

 

TheOC_29-1653399448092.png

 

So when I hit run inside of the macro, it is multiplied by 2, and the macro outputs:

 

TheOC_30-1653399448100.png

 

Okay sweet, I can pop this into my workflow and off I go…

 

TheOC_31-1653399448121.png

 

What is this?!

 

via GIPHY

 

Let's investigate!


I’ll open the macro again and head to the Interface Designer within the Macro. Same steps as before, and let’s supply the same value and hit ‘Open Debug’:

 

TheOC_32-1653399448131.png

 

Once again, I have a workflow with a Debug Log, Title, and the Interface Tools have been removed. However, I now have an error:

 

TheOC_33-1653399448163.png

 

This makes it a great deal easier to understand what my issue is. Looking at the Configuration Window of my Formula Tool shows me:

 

TheOC_34-1653399448175.png


The workflow is no longer multiplying – so clearly there is an issue here. Let’s head back to the Macro and have a look:

 

TheOC_35-1653399448191.png

 

I can see in the Action Tool, that “* 2” is being replaced instead of “2”. This was hard to spot as the Interface Tools only change the workflow when it is executed as a Macro or an Analytic App, so running the workflow would not produce this error. However, using the Debug functionality, I’ve managed to find the issue and fix it quickly.

 

Hopefully, this has been helpful. If you would like to read more about debugging, you can find some more information here.

 

Please let me know if you have any questions,
TheOC

Comments