Hi all,
I have an input file in Excel (attached 'Test file with Empty column.xlsx') with 2 columns, ID and Status. Status column is empty.
Excel input file:
Problem Statement: When I read this file in Alteryx, Status column is assigned the data type Double but I would like it to be of String data type.
Tried 3 methods to change the data type from Double to String:
- Formula tool - Using the Expression to replace Status column: ToString([Status], 0)
- Multi-Field Formula tool - Changing output type of Status column to V_String with the Expression: IIF(IsNull([_CurrentField_]),'',[_CurrentField_])
- Select tool - Changing the data type to WString
When reading the file after applying each transformation as specified above, the Status column is still assigned Double data type.
2 workarounds/solutions to change the data type from Double to String:
- Change settings in Input tool and use Dynamic Rename tool
- Step 1 - Connect the file to an Input tool and check 'First Row Contains Data'
- Step 2 - Use Dynamic Rename tool with Rename Mode: 'Take Field Names from First Row of Data'
- Multi-Field Formula tool
- Step 1 - Changing output type of Status column to V_String with the Expression: IIF(IsNull([_CurrentField_]),' ',[_CurrentField_]) and write to a file
- Step 2 - Read the above Excel as input and use a Data Cleansing tool to remove leading and trailing whitespaces and overwrite the Excel file
Questions:
- Is there a better way to convert the data type of empty column from Double to String keeping other columns intact?
- How does Alteryx assign the data type for empty/null columns? (Note: I tested with other files and it does not depend on the data type of the first column.)