Alteryx Designer Desktop Discussions

Find answers, ask questions, and share expertise about Alteryx Designer Desktop and Intelligence Suite.
SOLVED

Text To coloumn filed - Dynamically

Vishwak
7 - Meteor

I used text to column tool to split the data but my Field names are dynamic and not always the same, and sometimes the input file is blank.  my requirement is to change the filed name dynamically in Text to column tool and it should run even we don't have input field/file. 

Currently i changing the text to column field name always manually, Please provide the dynamic solution.

My sample flow provided in the attachment as a screenshot, Thanks in advance.

 

 

3 REPLIES 3
DavidSkaife
14 - Magnetar

Hi @Vishwak 

 

Here is a solution for dynamically changing the field name to Field1, so it doesn't matter what the original field name is.

 

Use a Field Info tool, add in RecordID and Crosstab (Record ID becomes the column header, Name becomes the column), use the Dynamic Rename tool to add 'Field' as a prefix, and then Union the original data back.

 

Capture.PNG

Workflow example attached (credit to the solution provided here https://community.alteryx.com/t5/Alteryx-Designer-Desktop-Discussions/Column-headers-as-first-row-of...)

 

Regarding your query on the blank input file its hard to provide a solution based off your screenshot as it looks like there is just that field flowing in? One option is to use a Count Records tool to control the flow but you also need to decide what happens to the whole process if no data is available

 

 

OTrieger
13 - Pulsar

@Vishwak 
David solution will work if the fields are in the same position in each of the files, however will not work in the field will be located in different position in the different documents, such as in one document is column A while in the other one it will be column C.

If you know what are all the possible variations of the different headers, you can create a mapping file and then set let say Field1 and use Dynamic Renaming tool to rename the different variations to Field1 and then you are good.

Vishwak
7 - Meteor

Thanks a lot.

Labels
Top Solution Authors