I have multiple files I want to bring into a workflow using a macro. The "core" fields are common across each dataset, BUT each data set may have 0-n extra fields that I do not need. These extra fields may have different field names from year-to-year. The "core" field names do not change from year-to-year. In my simple iterative or batch macro, I can use a Select tool to uncheck the unwanted fields, but this can't account for different unwanted fields in the other files and these will be included in the output. I am familiar with https://community.alteryx.com/t5/Weekly-Challenge/Challenge-72-Compare-Data-Sets-Fields-Columns/td-p...
Is there a way to auto exclude fields if they do not appear in the "core" group/list?
File 1
KEEP_1 | KEEP_2 | NOT NEEDED | KEEP_3 |
File 2
KEEP_1 | KEEP_2 | KEEP_3 |
File 3
NOT NEEDED | KEEP_1 | NOT NEEDED | KEEP_2 | KEEP_3 |
Solved! Go to Solution.
Have a Select tool right before the end of your macro. In the Select tool, uncheck the "Unknown" field at the bottom. This will automatically uncheck any field that is not in the originally checked list.
If your field names also have a common word in them, you can use a dynamic select tool. For example, only keep fields with the word "keep."
hi @hellyars
It sounds like you are very close already!
With the select tool, just deselect the bottom option of unknown - dynamic or Unknown Fields
This should get rid of all the ones you have not selected!