If a field name for a specific column keeps changing (ie. Number, PhoneNumber), how do I not call out the specific name but the column itself when using a formula tool? Is that possible?
Solved! Go to Solution.
This discussion might help: https://community.alteryx.com/t5/Alteryx-Designer-Discussions/Column-Indices-in-Alteryx/td-p/22459
You can also use a Multi Field Formula that uses a conditional and checks to see if a column contains a string within it that would designate it to be used in a calculation. I believe the response above is most likely your solution though if your fields are always coming in with the same column index.
Hi @blitz45
You can use a technique like this
The first two tools just generate random data with different field types. The bottom branch uses a Field Info tool to get the field names and a RecordID tool to generate the column indexes. The first Dynamic Rename renames all the fields to their respective index number. The Formula tool then calculates based on the column indexes, which are now also the columns names. The Select tool changes the column order to demonstrate that the rename will work even if the columns are shuffled, The final Dynamic Rename changes the column names back to the originals.
You can put any combination of tools between the two Rename tools. The second dynamic rename uses the "index" to find the corresponding original names and ignores any new columns or changes in column order.
Dan
Perfect explanation! thank you!