Alteryx Designer Desktop Discussions

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

Using a custom macro to convert data source date

crunyeon
7 - Meteor

Hi All.  I'm trying to import data from a CSV, then later in my workflow do a calculation on two dates.  When the data comes in through the CSV, however, the dates are strings.  So I built a custom macro that takes the string date and converts it to a DateTime value.  

 

My problem is that when I connect it to my data source, it only outputs the DateTime value and leaves all of the other data from the source (ie. names, order numbers, etc) behind.  How can I create a workflow that will run the dates through my macro to convert them, but then rejoin the converted date with the rest of the record that comes in with the source.

 

I included an example of what I would like to do along with the date conversion macro.  The input isn't a CSV but it should work the same.

 

Thank you.

2 REPLIES 2
RodL
Alteryx Alumni (Retired)

A Standard Macro will by default only pass whatever columns are in the Macro Input template.

To get the rest of the fields to come through, put a Select tool after your Formula too, and add the Action to "Update Select with Reverse Field Map" (linking the Macro Input to the Action to the Select).

I've attached a simple example.

MichaelCh
Alteryx
Alteryx

You may be able to achieve your ultimate goal (parsing a custom date/time) with the DateTimeParse function in the Formula tool. I think that would replace your entire macro.

Labels