2022.1.1.30569 Patch Release Update

The 2022.1.1.30569 Patch/Minor release has been removed from the Download Portal due to a missing signature in some of the included files. This causes the files to not be recognized as valid files provided by Alteryx and might trigger warning messages by some 3rd party programs. If you installed the 2022.1.1.30569 release, we recommend that you reinstall the patch.

Alteryx Designer Discussions

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

How to include Creation Time into a Batch Macro?

jason79121
7 - Meteor

Hi everyone,

 

I am still getting my hands on understanding batch macros. Originally, I created the macro because I have a huge directory of files with different schemas and needed to merge them together. One thing I need to include now is the Creation Time in order to perform further analysis. I tried included a select field and appended it before connecting to the output in the macro, but when I run my overall workflow it does not output the creation time. Does anyone have any ideas how to do this?

 

This is my batch macro

jason79121_1-1645117576027.png

 

This is my workflow which is able to join the files together, though it does not read the select field that I appended to include the creation time for some reason

jason79121_2-1645117636185.png

 

7 REPLIES 7
Jonathan-Sherman
15 - Aurora
15 - Aurora

Hi @jason79121,

 

I've got two thoughts on this, firstly are you looking to bring in the creation time of the input file itself or the time at which it was all merged together?

 

Secondly, if you're looking to bring in the creation time of each input file you could import the file name as part of the batch macro and join it back to the original directory tool to bring in the creation date info.

 

If you need a hand mocking up an example just let me know!

 

Kind regards,

Jonathan

jason79121
7 - Meteor

Hi Jonathan,

 

I am looking to bring in the creation time of the file itself as I need to perform a comparison of dates after the macro is run.

 

Would you be able to show me an example of the inputting the file name and joining it back please?

 

Best,

Jason

Jonathan-Sherman
15 - Aurora
15 - Aurora

Hi @jason79121,

 

If you use your batch macro to draw through the file name you'd be able to join it back to the original directory tool (containing the creation date):

 

JonathanSherman_1-1645119208799.png

 

If you have any questions just let me know, i've attached my workflow for you to download!

 

Kind regards,

Jonathan

jason79121
7 - Meteor

Thanks Jonathan!

 

I ran into some issues unfortunately. It seems I can't get the filename to match in the join because it is not an option after my macro runs (all of the column names change), making me lose the fullpath, filename and creation date and outputting the columns in the individual files. Do you have any idea how I can get these back in order to perform the join?

 

I tried checking off "Output filename as field", but i still seem to lose it after the macro runs

 

jason79121_0-1645121054668.png

 

jason79121_1-1645121117947.png

 

Jonathan-Sherman
15 - Aurora
15 - Aurora

Hi @jason79121,

 

I would double check the output you're getting from the macro in terms of the file name (most likely something along the lines of "filename.fileextension"), in comparison it looks as though your workflow is not generating the equivalent for your other join condition (i.e. the bottom stream in your workflow). If the two values aren't identical you won't be able to join on them.

 

Have you got an example of a file, what string are you returning from the macro and what string are you returning from the bottom stream to use as the join condition?

 

Kind regards,

Jonathan

jason79121
7 - Meteor

I figured it out, seems I had to close out and refresh the macro! Thank you for your help!

Jonathan-Sherman
15 - Aurora
15 - Aurora

No problem at all!

Labels