You can find the workflows used in the article attached to this post. They were built in AlteryxDesigner 10.1.
So let'sget started.
1. Show the selection options based on the columns of an input file
In the first scenario we want to load the column names from the fields in the input file. We can directly connect the Input Data tool to the “Q” connector of the List Box tool. This is a very simple workflow that updates a Select tool but of course this is applicable to more complex workflows. The List Box will read the names of the fields from the Input tool and show them to the user.
The names of the columns from the input file (CustomerID, FirstName, …) are showing on the left. By connecting the output of the Input Data tool to the List Box tool, the List Box tool is automatically set to read the ”Fields from Connected tool”. The result is that the user of the Analytic App will see the fields whenever the App runs as shown on the right. If the fields change in the input file, the List Box tool will get the new column names from the file. In the next scenario, this same feature is used but with a trick to load values from a column into the List Box tool.
2. Show the selection options from the values in one of the columns of the input file
In the second scenario, the user selection values should come from one of the columns, say the CustomerSegment column. In this example, there are 4 customer segments: Consumer, Corporate, Home Office, and Small Business. Rather than enter these values manually in the List Box (and have to again edit them if they change in the file), the trick is to create a temporary table with these values in the Field Names and then link the temp table to the List Box tool.
The list of segments (values) is created by using the Summarize tool on the field of interest. A count on the field is also calculated to have the data needed for the next step.
The trick in this workflow is using the CrossTab tool to create the temporary table and set the field names from the values of the segments. This is done by setting the Header Field to the field that has the values to be shown in the List Box, CustomerSegment in this case, and the Data Field to Count.
The output of the CrossTab tool will have the Segment values in the Field Names and the Counts as the first record. The Field Names have “_” instead of “ “ and so the Dynamic Rename is used to modify the names.
From this point on, the workflow is similar to the first one where the output of the Dynamic Rename tool is connected to the List Box tool to flow the values. The result is that the user sees the actual values coming from the input file every time the Analytic App is run.
3. Show the selection options from one of the columns of a user-selected input file
In both previous scenarios the input file was pre-defined in the workflow. In this third scenario, the user is given the option to first select a file and then select one of the values coming from one of the columns of this file. The file that the user selects must have the same columns (but not the data, for example a file that is updated monthly with new data) as the file configured in the workflow. This exampleis somewhat more complicated because by giving the user of the App the option to select the file, the file information is not available at the time when the List Boxvalues are created (Alteryx doesn'tyet know which file to use). The way around this is to use chained Analytic Apps. In this case, the first workflow offers the user the option to select a file and then saves two temporary outputs: the values to be shown in the List Box and the data from the input file. Before finishing, the first workflow launches the second workflow. The second workflow showsthe user the dynamically read values from the target column. Make sure you save these workflows as Analytic Apps.
The first workflow uses what was done in the workflow of the second scenario but outputs the results into a yxdb file. The hidden step in this workflow is to set the second workflow to start when the first one finishes execution. This is done by naming the second workflow in the Interface Designer(Alt-Ctrl-d) under Properties: "On Success – Run Another Analytic App". Also the "On Success - Show Results to User" shouldbe deselected.
Once the first workflow completes the run, it launches the second workflow. The second workflow implements the remaining steps to show the List Box to the user and update the filter and the output with the user'sselection.
You can find the workflows used in the article attached to this post. It was built in Alteryx Designer 10.1 (10.1.7.12188). To test the workflow please use the packaged yxdb file from_externals\1\CustomerFile4.yxdb or create your own but it must have a field named CustomerSegment.
Please see part 2 where we’ll show you how you can add more flexibility by allowing the user to select a file that doesn’t have the same fields as the one in the App configuration and then select from the values of one of the columns of this file/field.