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.
However, when I run this as an app and enter values:
I get the following results:
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:
Within the Interface Designer, click the second icon – the Test View:
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:
Click the ‘Open Debug’ option to the right:
This effectively opens the workflow that would run when these options have been supplied within the app. In this case, 25 and 2:
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.
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:
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.
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:
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:
So when I hit run inside of the macro, it is multiplied by 2, and the macro outputs:
Okay sweet, I can pop this into my workflow and off I go…
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’:
Once again, I have a workflow with a Debug Log, Title, and the Interface Tools have been removed. However, I now have an error:
This makes it a great deal easier to understand what my issue is. Looking at the Configuration Window of my Formula Tool shows me:
The workflow is no longer multiplying – so clearly there is an issue here. Let’s head back to the Macro and have a look:
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