This site uses different types of cookies, including analytics and functional cookies (its own and from other sites). To change your cookie settings or find out more, click here. If you continue browsing our website, you accept these cookies.
This 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.
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.
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.
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.
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.
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 email@example.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.