Get Inspire insights from former attendees in our AMA discussion thread on Inspire Buzz. ACEs and other community members are on call all week to answer!

Alteryx Designer Desktop Discussions

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

Access to filename in macro workflow

jeffv
8 - Asteroid

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

 

11 REPLIES 11
cmcclellan
13 - Pulsar

Assuming that your macro starts like this, just change "Output File Name as Field" to YES

 

2018-06-09 07_55_03-Alteryx Designer x64 - New Workflow1_.png

BenMoss
ACE Emeritus
ACE Emeritus

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

jeffv
8 - Asteroid

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 2018-06-10_20-00-34.pnga snapshot of macro.

 

 

 

Any hints?

 

Jeff

 

 

cmcclellan
13 - Pulsar

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.

jeffv
8 - Asteroid

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?

cmcclellan
13 - Pulsar

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 ?

jeffv
8 - Asteroid

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).

BenMoss
ACE Emeritus
ACE Emeritus

The reason this does not work is because you are using a 'macro input'.

 

In fact you want to use the 'control parameter'. The icons are very slightly different.

 

batch.png

 

See attached.

 

Ben

 

jeffv
8 - Asteroid

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

Labels