Let’s talk Alteryx Copilot. Join the live AMA event to connect with the Alteryx team, ask questions, and hear how others are exploring what Copilot can do. Have Copilot questions? Ask here!
Start Free Trial

Alteryx Designer Desktop Discussions

Find answers, ask questions, and share expertise about Alteryx Designer Desktop and Intelligence Suite.
SOLVED

Macro using List Box [Update Select with multi-select ListBox] and Drop Down

AlteryxTrev
10 - Fireball

Hello,

 

I have a file (10K rows by 100 columns). One column is an ID column and all other columns are additional attributes for that ID. This file is used solely to append these fields to another data stream based on this ID. In a simple world all users could have access to this file and add it to their workflow using a simple join tool to append the fields that they want. However, in my world we do not want them using the source file. Instead, we have embedded this file within a macro such that they can send their data stream into the macro and select the fields they would like to append. When the user connects to the macro they are presented with a List Box with all available fields to append and they can make the appropriate selections. The output will be their original data, plus any fields they selected to append. This has worked great, however, there are so many fields in 100 column file that the users are finding it hard to find the columns that they need. How can I update the macro to present a drop down AND a list box such that the user can select a field type in the drop down and the List Box only shows those fields that are of the same Field Type?

 

In general, I want to be able to better segment these 100 columns that are available for append by giving the List Box a little bit more structure. EDIT: Or, if I have the ability to Categorize these fields using the Description field in the Select Tool (So I am not limited to Field Type) that would be even better).

 

Below is the setup that I currently have. The List Box / Action tool work perfectly to present the user with all available fields to append. The Drop Down / Action tool is my attempt at what I described above with the drop down.

 

trevorwightman_0-1665164021181.png

 

2 REPLIES 2
AlteryxTrev
10 - Fireball

After doing more research I was able to figure out one way to do it such that I could create my own categories: https://community.alteryx.com/t5/Alteryx-Designer-Discussions/HJow-to-use-a-List-Box-Tool-in-the-rig...

 

First I figured out which fields I wanted in each group and I defined them as such in the List Box

trevorwightman_1-1665166066025.png

 

Then I just added a ListBox/Action tool for each of the categories that I wanted to use.

trevorwightman_0-1665166030604.png

 

Additionally, in the future if more fields are added to this reference file I can just add the field in question to whichever category it belongs to.

 

If anyone has a better or more interesting way to do the above I would love to learn a different way.

 

Thank you!

danilang
19 - Altair
19 - Altair

Hi @AlteryxTrev 

 

Here's a different solution using a Tree tool.  The setup is longer, but this allows you to change possible fields without having to change the workflow.

 

danilang_3-1665248165020.png

 

 

The tree is an underused interface tool, because its setup and use is more complex than the other tools.  In this case I defined the tree structure in the tree.csv file  

danilang_1-1665247682497.png

The keys define the structure of the tree.  The keys of length 2, 01, 02 and 03 are top level.  The other keys define the leaf structure 0101 is the first leaf under the 01 branch, 0102 is the second etc.  In the interface, the relationship between key length and nesting level becomes more apparent

danilang_2-1665247893823.png

This list of selected keys are passed to the app as a list delimited with new lines.  The top part of the workflow deals with this list and builds up a comma delimited unique list of the selected descriptions.

 

The bottom part uses a Field info tool to get the schema of the data input, appends the list of selected descriptions and determines if the Data field was selected in the interface.  If yes, the field name has "_keep" appended to it, the fields with _keep in the names are selected in the Dynamic Select tool and the final Dynamic Rename restores the original field names. 

 

In action it looks like this with only the selected fields passed to the output.

danilang_4-1665248429303.png

 

If the schema of the data changes, you only have to update the tree.csv file to have the workflow adapt to the new structure

 

Dan 

Labels
Top Solution Authors