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 Rename Tool on our way to mastering the Alteryx Designer:
The Dynamic Rename Tool is part of the developer category of tools. It allows the user to quickly rename any or all fields within an input stream by employing the use of different methods.
The user has the option to rename only certain fields, all fields, or even dynamic/unknown fields at runtime (e.g. after a Cross Tab Tool). The option for renaming fields are:
Renaming using Formula
This is useful if there is a pattern to the fields you want to rename, e.g. if you want to remove a prefix or suffix, or want to replace underscores with spaces.
In this example the Cross Tab Tool replaced spaces with underscores and added the prefix "Sum_" to all store types. Using the formula replacechar(regex_replace([_CurrentField_],"Sum_",""),"_"," ") in the Dynamic Rename Tool removes "Sum_" and the underscores:
The Dynamic Rename Tool will also pick up new headers so you don't have to worry about checking for new store types.
Take Field Names from First Row of Data
Often, the field names aren't the header row in your file, they are in a subsequent row. In that case, you can use the option "Take Field Names from First Row of Data". This option discards the headers and replaces them with the first row of data. What if your field names are in the 3rd row of data? You can use the Sample Tool to skip the first two rows of data and then use the Dynamic Rename Tool to get the headers from what used to be the 3rd row of data.
Take Field Names from Right Input Metadata
If you have two files with the same layout, one with headers and one without, you can use the metadata from the file with headers and apply it to the file without headers. You can even apply field types and sizes. This option requires the tool to have a right input.
NOTE: The order of fields has to be the same in both files as it renames by position.
Take Field Names from Right Input Rows
Select this option if you have been provided with a file without headers and a separate layout file. It requires a right input wich should contain the layout file. It allows you to either do a positional rename which requires the fields to be in the same order, or a rename using a field on the layout file.
See the attached v10.5 workflow for the examples above in Alteryx.
By now, you should have expert-level proficiency with the Dynamic Rename 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