let’s say I have 20 fields in a specific left-to-right order, and the first record contains a unique identifier for each field.
How can I reorder the fields by reordering the first row unique identifiers?
So this is kind of like doing a join but based on fields instead of records.
I know I can do this with transpose/crosstab but was wondering if there is another way?
Solved! Go to Solution.
I have attached a workflow that is similar to what I think you are describing.
One way to reorder columns is to use the select tool.
You can rearrange the sequence of the fields by selecting a field from the configuration window and then using the two arrows at the top.
Hope this helps, if it does please like this post and if it helps resolve your problem, mark it as a solution. If you have any other questions, please let us know.
Hi @Carluccio555,
Here is one way of doing it, sample workflow is attached. I used the Dynamic Rename Tool to temporarily swap first row data as column name, use the Select Tool to sort columns by ascending order, before renaming the columns again to the original column names.
Let me know if this helps!
Thanks I will take a look when I’m at my desk.
For now, to clarify my question:
The fields have a unique Id in record 1
eg. ID1, ID2, ID3
if I have a separate Text Input input tool with a single record as follows:
ID3, ID1, ID2
How can I effectively perform a SELECT action that outputs the fields in the order in the Text Input? If I wanted to ever change the order this would be done by changing the order in the Text Tool, not by using a SELECT tool
thanks
You would have to use a sort tool to sort them in the proper order if they are in a single column.
If they are field names, you can move the column names using the up/down arrows.
Ok now I’ve realized I can probably just do this with a Union tool right? 😂
You can union the 2 datasets if you need to merge them eventually, then re-order the proper columns or records needed.
The text input exists only to set the order, it is a single record of the unique IDs reordered
Im not at my desk but I’m sure there’s a Union tool option that will Union the data to the text tool matching by field name, so effectively reordering by the text input.
Hey @Carluccio555, if that's the case, then yes a Union tool is all you require, configured to "Auto Config by Name". Remember to set the output order where the Template file is first in order so Alteryx takes your template header order.