Advent of Code is back! Unwrap daily challenges to sharpen your Alteryx skills and earn badges along the way! Learn more now.
Free Trial

Tool Mastery

Explore a diverse compilation of articles that take an in-depth look at Designer tools.
Become a Tool Master

Learn how you can share your expertise with the Community

LEARN MORE

Tool Mastery | Dynamic Select

Kenda
16 - Nebula
16 - Nebula
Created

Dynamic Select.pngThis article is part of the Tool Mastery Series, a compilation of Knowledge Base contributions to introduce diverse working examples for Designer Tools. Here we’ll delve into uses of the Dynamic Select Tool on our way to mastering the Alteryx Designer:

Have you ever wanted to restrict the fields that flow through your workflow based on their data type? What about only allowing fields that begin with the same word or are in a specific position? The Dynamic Select tool is just what you’re looking for!

The Dynamic Select has two options in the top drop down menu: Select Field Types and Select via a Formula.

  • Select Field Types(attached in the v11.0 workflow Dynamic Select.yxzp):

This option allows you to select specific field types so that only the fields with those types flow through. The user has the ability to select individual types with the checkboxes.

There are also buttons that make it more efficient to (de)select multiple types at once.

options.gif

In the first example below, the user only wants to keep the numeric fields, so they click the ‘Numeric’ button in the Configuration window. As you can see, this will select all numeric types from Byte all the way to Double. Only the fields with the chosen types will be passed to the next tool.

1.png

2.png

  • Select via a Formula (attached in the v11.0 workflow Dynamic Select.yxzp):

When you choose to change the selection via a formula, there are many Fields available in the Variables box within the Configuration window.

3.png

In the above snapshot, the fields listed in the yellow section are attributes of your specific columns of data. Other than Scale, which works with Fixed Decimal data types, these fields are the same as the ones listed when you click on a connector on the canvas (or click Metadata in the Output window). The orange section contains Boolean test functions. The green section refers to the field position number.

In the next example, we want to only keep fields if they are strings or dates, but we do not want the Station field. We will use the following expression:

[IsStringOrDate] && !contains([Name],"Station")

This leaves us with just two fields that meet the specified criteria.

4.png

If a field name ever gets changed early on in a workflow or does not always come from the input named consistently, a normal Select tool may not capture these changes. Instead, as long as the field order remains the same, the Dynamic Select tool can be used.

Say we want to keep just the State and Date fields, as in the previous example, but the Date field doesn’t always have the same name. The following configuration allows us to accomplish this task.

5.png

This method can also be applied when you have various different data sources but you always want to perform a process to the first and fourth fields.

One user had yet another use case on the Alteryx Community. They had one source file that contained a list of field names and another source that contained the actual data. They were able to use the Dynamic Rename tool in combination with the Dynamic Select tool to only keep the field names that were in the list. Check out the post and solution here.

By now, you should have expert-level proficiency with the Dynamic Select Tool! If you can think of a use case we left out, feel free to use the comments section below! Consider yourself a Tool Master already? Let us know at community@alteryx.com if you’d like your creative tool uses to be featured in the Tool Mastery Series.

Stay tuned with our latest posts everyTool Tuesdayby followingAlteryxon Twitter! If you want to master all the Designer tools, considersubscribingfor email notifications.

Attachments
Comments
LBjerner
5 - Atom

The Dynamic Select tool is very powerful, but I am missing one part which would make it really dynamic!

If I have a report with 12 months, I would like to have a dynamic input to either "fieldnumber" or "name" (see below).

As an example, I would like to make an input variable where I could change the revenue8 to revenue9 by just changing the last number "8" to "9" .

 

This (below) works today, but I have to make the change in the text below, where I believe an input variable would be more practical.

 

([FieldNumber] = 3) OR
contains([Name],"revenue8") OR
contains([Name],"profit9")

 

chinta
7 - Meteor

Hi Kenda, 

 

Can we use Dynamic Select to change the data type of a field? 

 

Best, 

Kenda
16 - Nebula
16 - Nebula

Hey @chinta 

 

Good question, but with this tool, you're just selecting fields! You might want to try the Multi Field Formula tool, though. With that one, you can use a custom expression to select fields and can change the field types.