Hello Alteryx Community,
I’m working on a workflow where I need to dynamically assign the correct data types to fields in my dataset. I initially tried using the Auto Field tool, but I noticed that fields like ID, which contain only numbers, are automatically identified as Double or Integer, rather than as V_String when needed.
My Approach:
To handle this, I created a FieldType reference file where each tab corresponds to a data file and contains a list of fields along with their correct data types.
Here’s a simplified example of my data:
Input Data (Customer Data)
ID | Name | Hours | Price |
7865 | Jane Rim | 5 | 45.2 |
1256 | Kate Winsom | 6 | 56 |
6485 | Lilly Diya | 5 | 50.5 |
2223 | Kaley J | 4 | 40 |
1100 | Eric Cao | 2 | 30 |
1564 | Ali Hamad | 1 | 20 |
Current Data Types (After Importing into Alteryx)
FieldName | Data Type |
ID | Double |
Name | Double |
Hours | Double |
Price | Double |
Desired Output Data Types
FieldName | Data Type |
ID | V_String |
Name | V_String |
Hours | Int32 |
Price | Double |
Challenges & Attempts So Far:
Question:
How can I dynamically apply the correct data types to my dataset using my FieldType reference file in Alteryx?
My goal is to create a macro that can read the correct field types from the reference file and apply them to different datasets automatically.
I’d appreciate any guidance or alternative approaches!
I've attached the Customer Data and FieldType files for reference.
Thanks in advance!
Solved! Go to Solution.
@hcho one way of doing this by updating the XML of the select tool using batch macro
@hcho Here is a potential solution. Would this be what you are looking for?