We are celebrating the 10-year anniversary of the Alteryx Community! Learn more and join in on the fun here.
Start Free Trial

Alteryx Designer Desktop Discussions

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

Adjust Field Types

hcho
8 - Asteroid

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)

IDNameHoursPrice
7865Jane Rim545.2
1256Kate Winsom656
6485Lilly Diya550.5
2223Kaley J440
1100Eric Cao230
1564Ali Hamad120

 

Current Data Types (After Importing into Alteryx)

FieldNameData Type
IDDouble
NameDouble
HoursDouble
PriceDouble

 

Desired Output Data Types

FieldNameData Type
IDV_String
NameV_String
HoursInt32
PriceDouble

 

Challenges & Attempts So Far:

  1. Select Tool – Works for manually changing field types, but I want to convert this into a macro for dynamic use, so this isn't a viable option.
  2. Auto Field Tool – Automatically assigns numeric fields as Double/Integer, even if they should be V_String.
  3. Dynamic Select Tool – Doesn’t provide an option to change field data types.
  4. Multi-Field Formula Tool – Allows changing data types but only one at a time, which isn't practical for multiple fields with different types.

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!

2 REPLIES 2
binuacs
21 - Polaris

@hcho one way of doing this by updating the XML of the select tool using batch macro

image.png

Colman_Hendershot
7 - Meteor

@hcho Here is a potential solution. Would this be what you are looking for?

 

Labels
Top Solution Authors