Alteryx Macros Made Simple: Analytic Applications
Welcome to the 2nd part in this series about Alteryx Macros, this blog focuses on Analytic Applications and shows you how to create and use them via the analytics gallery. If you want to learn about Standard Macros, have a look at the first blog in this series.
Analytic applications are workflows hosted on the Alteryx analytics gallery. They are developed with the same premise as macro’s in that they are designed to be flexible but produce a standard output.
Analytic applications (analytic apps) are designed initially offline but can then be shared with a wider audience by uploading it to the server environment. One of the key benefits of analytic apps is that they are not just restricted for use by those with Alteryx designer licences, anyone within a business can run the app via the server.
One good example would be a filter application, where users upload their data, specify which columns to filter then select the values which they wish to filter down to. This type of application could be useful for people that struggle to process larger data sets as this application will filter and significantly reduce the size of the.
I’m going to build out this example and walk you through exactly how applications work, how we can publish them, and how we can share them.
Before we even start developing our workflow, lets change the configuration of our Alteryx file to an ‘Analytic App’. In order to do this click anywhere on the canvas to bring up the workflow configuration pane. Then navigate to the ‘Workflow’ tab, before selecting ‘Analytic App’ from the type menu. You will notice now that as you drag tools onto the canvas they will automatically have the thunderbolt icon on top, indicating that you can connect to them through interface tools. Secondly when you save your workflow the extension of the file will be given as a ‘.yxwz’ file.
File Browse Input
Lets start with the input of our data into the workflow. Instead of inputting our data into the workflow using the ‘macro input’ tool, as with the previous blog and standard macros; this time we will use the ‘file browse’ interface tool.
The file browse tool allows the user to to overwrite the placeholder input file with one of their own. If we drag the File Browse tool onto the canvas and connect it to our input data tool, we can then begin configuring first the file browse, and subsequently the action.
First we specify the text that we wish to be displayed by the user.
The second parameter we must define is whether the file browse should be seen as a ‘save as dialog’, what this means is that we are specifying the location we want to either read from (save as dialog unticked), or write too (save as dialog ticked); as we want our user to input their data into the workflow, we will leave the ‘save as dialog’ box unticked.
We next have the option to determine the file formats that we wish are user to be able to select from.
By default, ‘Standard Database File Formats’ is selected, this means your file browse will be able to input the same standard files as you can with a traditional input tool. A list of support file formats can be found here.
If you wish for the user to only be able to select specific files, such as Microsoft Excel files, then you can use the ‘Arbitrary File Specification’ option.
When applying the action from our file browse to the input tool, there is a special option available, ‘Update Input Data Tool (Default)’ which is not available with other interface tools. What this simply means is to overwrite the entire configuration of our input tool with the file specified by the user.
Drop Down and Text Box
The second part of the macro is the configuration of the filter tool.
I have used a very basic condition.
[Column] = “Dimension Member”
As a result we will need two interface tools facing our user, first of all a interface tool that allows them to specify the column they wish too look for values within, and secondly an interface tool that allows the user to specify the dimension member they wish to match.
I have used a ‘Drop Down’ tool to allow my users to select the single column they wish to search. I have connected my File Browse tool to my drop down tool so that my drop down populates with columns from the users dataset (essentially by doing this the file browse passes it’s meta data into the drop down).
You can see from the configuration window that as I have connected my file browse to the drop down, the ‘list values’ has automatically chosen the method to populate as ‘File Browse in this Analytic App/Macro’.
We can also determine what type of columns we want our user to be able to see. This is useful when we are working with functions that rely on specific data types such as strings or numeric fields.
Finally you can also add a [None] option, should you wish your users to be able to select no column, in my case I have left this unchecked.
We also need a method of allowing our user to specify their matching value. I have used a ‘text box’ tool to allow my user to specify the value.
Within my action I am then simply updating the placeholder operand value “East” with the value given by the user. Of course this method requires our user to have a knowledge of what values exist within the field. It is possible to populate say, a drop down menu, with the values contained within the column specification through a chained app, but we will look at that another day.
File Browse Output
Finally we need to pass the output data back to our user. The configuration is very similar to that of the input data tool. We will essentially use a file browse tool to overwrite our placeholder output file.
This time however, we will check the ‘save as dialog’ option, as we are writing data to a file rather than reading data from a file. Again I will use the ‘Standard Database File Formats’ option so our user can save the file in any supported type they wish.
The application shown in this example can be ran or downloaded from the Alteryx Gallery here.
The Interface Designer allows us to control the layout of the user interface for our end users. It is accessible by either going to ‘View’ on the top toolbar and then selecting the ‘Interface Designer’ option, or through using the shortcut, Ctrl+Alt+D.
I don’t want to dwell too much on this part of building an application as we will cover it off in a good level of detail in a future post, but the help guide available on the Alteryx site will help you gain a strong understanding on how it can be used.
Publishing and Sharing
In order to save your work to the Alteryx gallery (or your own server instance), you must go to file and then save as. Beneath the traditional browse option which allows you to save your application locally, there is the option, by default, to save to the Alteryx Gallery, alongside the option to ‘Add a gallery’, should you wish to publish to your own Alteryx Server instance (note once you connect once you will not have to keep adding your gallery).
In the save menu you will be able to specify the workflow name, any additional details (which can give instructions on use for example), and also manage the workflow assets.
Given that my workflow is not dependant on either the input or output I will uncheck the option to include them. When your application contains macro’s or input files which are required for the application to run correctly it is important that you package these assets.
Once we select ‘Save’, if you have checked ‘Validate workflow then save’ the application will try to run in its current state to identify any issues, if you have not checked this option then the application will save straight to the gallery (note that even if the workflow fails to validate it will still be uploaded to the server instance, the validation process is simply to highlight errors that may affect run performance in the online environment).
By default your application is saved the your ‘Private Studio’, so it is important to make sure you share your application by using the ‘sharing’ drop down where you can specify either the whole gallery (i.e. everyone can see it), or a specific collection (i.e. only a select group of people can see it).
It is also possible for your users to run the application in an ‘offline’ environment should they have Alteryx Designer installed on their local machine. They can do this either by using the ‘Download’ option available alongside the ‘Run’ option; or by sharing the file directly either as a ‘.yxwz’ file, if your workflow does not have any dependant assets, or as a ‘.yxzp’ file if your workflow does have dependant assets.
Should your workflow contain ‘forbidden’ tools, as outlined in the section below, it is possible to disable the ability to run the application in the online environment by going to the workflow settings.
Once they have saved the file they simply double click on the file through the file explorer and the application window will launch.
Usecases and Limitations
Another example of an application could be a geocoding application. Users pass in a dataset which contains a location type field, but they do not have longitude’s and latitudes. A workflow can be designed to convert the location type field into latitude and longitudes either by using the geocoding tools available in Alteryx, or by linking in an external data set (you may even think about using the google API).
In the user interface your user would simply browse to their file and select the location field, they press run and receive an output which they can then download and use.
An example geocoding application can be downloaded here.
At this point I should mention some of the limitations of applications in Alteryx. Applications that make use of the R tool or download tool (like the geocoding application linked above), cannot be ran from the Alteryx gallery in case they contain harmful scripts (though they can be ran on your own server instance).
It is also not possible to use the folder browse tool when deploying the application in the server environment.
You may notice that the output file browse works differently when using the application in the online server environment and when using the application on your local machine. When running the application on your local machine you will have the option to write to a specific location. However when using the file browse for output in the server environment you will only have the option to specify the output name and the file type, this is because the server cannot write to your local machine; instead once ran, the application will give the user the option to download there file if they wish to use it.
I hope this blog has been useful and check out the next post in the series in the near future, but before I go I just want to outline some key resources to help you along the way.
Some of my favourite examples of Alteryx applications available on the public gallery