Alteryx Designer Desktop Discussions

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

Change data type of specific row

jaymullens
6 - Meteoroid

Hello,

 

First post, I am quite new to Alteryx and am trying to find a way to change the data type of specifc rows.  My data has multiple header rows, however once I have the desired output, the headers in columns that are designated datetime format lose their value and I cannot replace it.  Is there a way around this?

 

If not, would I need ot separate the data into multiple tables and then re-combine at the end?

3 REPLIES 3
carlosteixeira
15 - Aurora
15 - Aurora

Hi @jaymullens 

Have a look at @CharlieS solution here: https://community.alteryx.com/t5/Alteryx-Designer-Discussions/Dynamically-Change-A-Field-Type/td-p/3...

 

Maybe this help you.

 

Tks

Carlos A Teixeira
danilang
19 - Altair
19 - Altair

Hi @jaymullens 

 

Once data has been imported into Alteryx, it's always in an X rows by Y Columns format.  Each of the columns has a name i.e. "HireDate" and a format "Date". This format applies to all of the values in all the rows in that column.  All of the values in that column have to be compatible with the column type.  If you have a column formatted as "Double" you can store Doubles, Bytes, Int16s, Int32s, etc within the column without any data loss.  On the other hand if your column is defined as Int16, any number that you put in this column will have its decimals removed.  A value like 2.4 will become 2 when placed in an integer type field. 

 

This concept of compatibility is key if you're trying have multiple field types in one column.   You can't have a Date column where the values in row 1 and 2 are Strings and the rest of the values are Dates because you can't put an arbitrary String in a Date field.  You can, however, store any type of value in a column defined as a String, by applying a suitable conversion function.  ToString(N) will convert the number N to a string representation.  Dates can be stored in string fields with no conversion required because the internal storage format of a data is String.

 

Getting back to your specific case, if you want to have String header values with Date values in the same column, define the column type as String, not as Date.  The other alternative is to filter out the header rows and treat them separately from the data rows.  

 

Dan       

jaymullens
6 - Meteoroid

Thanks both.

 

@danliang - Makes sense, shall follow your advice.  Appreciated!

Labels