Just thought maybe someone might have insight to something I need in a workflow...
Say I have a macro:
1: Macro input with file name
2: Filter
3: Summary
4: Table
5: Email
Is there access to the filename passed in to include in the email? By access I mean can I include in email the name of the file passed to macro?
Thanks!
Jeff
Solved! Go to Solution.
Assuming that your macro starts like this, just change "Output File Name as Field" to YES
Yes of course this is possible.
One of the options in the input tool is to 'Output File Name as Field'.
In your summerize tool and table tool be sure to 'group by' this 'FileName' field, which will then be passed to the email which you can then include as a field.
Have a go and let us know if you get stuck!
Ben
So while I thought with the response you have given I thought I was good to go.... uh... not quite... You answers were right on and I'm able to see the file name and use it as needed. However, the bigger picture of the macro didn't quite go as planned....
From the driver program I am "passing in" the file name... I thought with macro input I could use the file name passed. (In my simple test I wanted to pass a few file names in, then the macro would grab the name open the file do a filter on a particular sheet, summarize and get count of rows, then send an email to me with filename and count.)
I'm not understanding how to get the macro input to used the file name passed from the driver. Maybe I'm using wrong type of macro? I was using batch macro. Below is a snapshot of macro.
Any hints?
Jeff
Probably just a standard macro, why the need to use a batch macro ?
Batch macros loop and group the input in order to create the output.
So with standard macro I can't seem to connect the output connector of the macro input to the lightning bolt of the input connector... is there a trick to get them to connect?
That's not usually a problem, but I don't use macros much either. I can create a standard macro that connects the Macro Input tool to the Input Data tool, but it might not be your use case for a number of reasons.
Can you attach your macro so we can see why it won't work ?
Sure... I've tried to simplify to make debugging a bit easier...
I have two files in c:\temp\test1.xlsx and test2.xlsx each with a worksheet Test with one column where a1 is called f1 and have a few numbers below in both files (different number of rows and values).
I have included the driver and the macro... (macro first file).
That worked! A happy dance!!!
If possible, for my learning and understanding, some follow up.
a) why a batch macro? why doesn't a standard one work?
b) I went to macro training this past week at conference and I thought I heard control parameters are used with iterative macros to determine when iteration should stop. From this thread I am learning that control parameters can be used in multiple types of macros. Right?
c) Macros seem to be an advanced area in Alteryx but not sure why there is a good tutorial (maybe there is and I haven't run across it). Specifically, my current understanding is that batch macros are for the situation that you want process groups of data and iterative are when you want to repeat a process until a certain condition is reached. This case I just wanted to process a list of files so I was thinking a standard macro... where am I off in my understanding?
Thanks for everyone's help on this... trying to overcome the macro barrio.
Jeff