Alteryx Designer Desktop Discussions

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

Changing Column Header Data Type Without Changing Rows

markalves
8 - Asteroid

I need to be able to change the column header to a custom format in order to upload into a separate software.  Currently the date is in the format of 08/31/2021.  I had to do a dynamic rename in order to change the column header name while preserving the data type of the rows as double meta data type.  This is the formula: 

datetimeformat(DateTimeAdd(datetimefirstofmonth(),-1,'days'),'%m/%d/%Y')

 

However, when I open the excel sheet I noticed that the format of the header's cell is in the "general" format.  I want to get it to a custom format of mmm-yy.  The date will look like Aug-21, but the value will still be 8/31/2021.  This is the only way the upload will work for some reason. 

 

markalves_0-1630686507391.png

 

3 REPLIES 3
markalves
8 - Asteroid

Just to clarify if I use the formula datetimeformat(DateTimeAdd(datetimefirstofmonth(),-1,'days'),'%b-%y') which makes the date look like  Aug-21 this also does not work.  The column header value needs to still be in 08/31/21 format.

Maskell_Rascal
13 - Pulsar

Hi @markalves 

 

Maintaining the custom format within an Excel output is possible, but only through using a selected range. So you could in theory do this by configuring your output tool as something similar to this:

Maskell_Rascal_0-1630689014270.png

 

You would just need to make sure that the range is large enough to meet your needs. That being said, you will still run into the problem of a string field being written to a date field if you use your formula. Since the field in question has both a date and what appears to be currency in it we'd need to solve for that by first outputting your headers and then outputting your data. 

Maskell_Rascal_1-1630690231771.png

 

Excel File Before:

Maskell_Rascal_2-1630690317391.png

 

Excel Output After Workflow:

Maskell_Rascal_3-1630690438328.png

 

Attached is a zipped version of the workflow for you to try out. 

 

If this solves the problem please mark answer as correct, if not let me know!

 

Cheers!

Phil

markalves
8 - Asteroid

Your theory and workflow are spot on for being able to change the header data type without changing the rows data type, so I will accept this solution as an answer. 

 

However I guess it is just a limitation of Alteryx, where I can't have the value of the date as 8/31/21, but have the format be mmm-yy as the visible value in excel.  I thought that if I was able to convert the column header to a date meta data type it would solve it, but I get a "null" value when converting the mmm-yy into a date type.  If I keep it as a string of mmm-yy (Aug-21), the value is no longer 8/31/21 when I open my excel file, which causes my upload to my other software to fail. 

Labels