community
cancel
Showing results for 
Search instead for 
Did you mean: 

Alteryx Designer Knowledge Base

Definitive answers from Designer experts.

Dynamically Create List Box Values From Input File - Part 2

Alteryx
Alteryx
Created on

In a previous article we’ve shown how the list of selections in the List Box tool can be dynamically generated from:

  1. the column names from an input file
  2. the values in one of the columns of the input file
  3. the values in one of the columns of a user-selected input file (target field must be in both origina...

 

In this second article, we’ll see how to let the user select both a file and a field within this file to create the values in the List Box. The file that the user selects doesn’t need to have the same columns as the one you used when building the App.

 

Show the selection options from one of the columns of a user-selected input file and field

 

In this example we will use the techniques we’ve explained in the first article including, reading field names from input, creating value list and using chained Analytic Apps to show the second screen with the list of values for selection. Again, make sure you save these workflows as Analytical Apps.

1.png

 

The first workflow uses what was done in the previous article but relies on the fact that Alteryx yxwz files are XML files containing the configurations of the tools of the workflow. To load the user-selected values into the second List Box, we will manually update the XML of the second workflow to change the List Box configuration. The List Box tool, when set to Manually set values, expects a Name:Value pair and therefore we are using the Multi-Field Formula tool to create these pairs and change the field size to make sure it fits the extended text. We then use the Summarize tool to concatenate all of the separate values into a single field with new-line (\n) as separator.

 

2.png

Now that we have our List Box Values ready it’s time to load them into the second workflow. For this to work, we should have already built the second workflow, ProcessWorkflow.yxwz and setup the List Box tool List Values to Manually set values with the value set to _xxxx_:xxxx.

 

3.png

 

Back to our first workflow, we start by reading in the second workflow we just created. To be able to read it into Alteryx, we set the Input Data tool to read the file as CSV with \0 as the delimiter (no delimiter) and with first row contains field names.  

 

4.png

We then use the Summarize tool to concatenate the rows into a single row and make sure you name the field <?xml version="1.0"?> (this will be the first line in our output file).

 

5.png

 

 

We bring in the list of values we created in the first part of the workflow and append it to this data stream using the Append Fields tool and then use the formula tool to find the _xxxx_:xxxx text and replace with the correct values. We deselect all fields except the <?xml version="1.0"?> using the Select tool and write the output to a new file ProcessWorkflow2.yxwz using csv as format and \0 as delimiter.

 

6.png

 

The last step in this workflow is to set the new workflow we just wrote-out 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" should be deselected.

 

7.png

 

You can find the workflow used in the article attached to this post. It was built in Alteryx Designer 10.6 (10.6.6.17413).

 

Special thanks to @patrick_digan for testing and suggesting improvement to the example workflow.

 

Happy App-Building!

Attachments
Comments
Atom

Hi, Fbassil;

 

Thank you for your detailed instructions.

 

Joseph

Is there a way to combine this structure with the helpful name/value pairing with the other non-file inputs?

 

What I'd like to do is create create a table using the other tools that has a list of name/value pairs that would then always be used as inputs to the list box. I don't want the user to upload a file for these, but I do want the flexibility of having the name and value be different. The names for the options are long and unwieldy and not really suitable for fieldnames anyway and there is a much simpler code to search by.

 

Thank you.