Alteryx Designer Desktop Discussions

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

Nested Macros - Avoiding repeated calls

johnyarham
5 - Atom

I have a macro that takes raw data from several sources and transforms it into a number of cleansed tables. This macro should happen first and I then want to call a number of different 'test' macros, each of which uses some of the outputs from the initial preparation macro. At the moment, each different 'test' macro is being treated individually, meaning the preparation macro is being run for each different 'test' macro - obviously this is very inefficient as the same transformation work is being done every time. 

 

Is there a way to set up a single workflow that runs the preparation macro once at the start, then calls each of the test macros afterwards? I suppose I could output the preparation macro tables to actual files then read these back in for each test macro, but it feels inelegant, and breaks up the idea of a single workflow into one prep workflow and one test workflow. Also, I am not sure I can set up a file input when the file doesn't actually exist until the preparation macro is run (this should be a stand-alone end-to-end process)

 

Cheers

5 REPLIES 5
JordanB
Alteryx
Alteryx

Hi @johnyarham

 

Could you please send a screenshot of how you have the macros linked up currently? 

 

Best,

 

Jordan Barker

Solutions Consultant 

johnyarham
5 - Atom
Hi Jordan,

Unfortunately I am having some technical difficulties and am currently unable to open Alteryx at all (clicking the icon does nothing) so can't screenshot the macros. I am trying to resolve this and will get screenshots when I can.

Essentially however I have:

Workflow 1 - a macro that takes input data, transforms it, creates a macro output (2 different outputs atm). I want this run once.

Workflow 2...n - multiple macros that each call the workflow 1 macro at the start before running tests and generating a macro output.

Workflow n+1 - contains multiple discrete processes, each of which starts with a call to the appropriate test macro 2...n) to get an output, and outputs to excel.


Now I could scrap the final workflow (which basically just gets macro outputs and sends to excel) and have all the test macros output straight to excel, but they would have to be run individually (again resulting in multiple calls of workflow 1) which is pointless. Either that or all the test processes could be driven from a single call of workflow 1 which would be a horrendously complicated workflow as there are loads of tests!

Hope this is helpful whilst I resolve me program access issues!

Thanks

John
johnyarham
5 - Atom

Hi Jordan,

 

I have now reacquired access so have some screenshots to share, which will hopefully clarify my issue. 

 

The main macro being called is this one. This calls a number of separate Test macros and outputs the results of each to Excel files.

Process.PNG

Each of these test macros looks similar to the example below. They all call the same pre-processing/transformation macro to begin with then perform various edits and output the results for the overview macro above to use.

 

test.PNG

 

The standard pre-processing/transformation macro used by each Test macro looks like the below. There are 3 import macros called to start with to get the raw data, then some transformations are applied, with a number of outputs created. These are then used as required by each test.

pre-processing.PNG

 

Currently therefore, when I run the top macro, the entire import/transformation step is performed for each Test macro called. This is obviously unnecessary as the preprocessing/transformation part could be done once then each test macro run using the outputs. Is there a way to do this other than by having either an enormous workflow, or by somehow outputting the transformed data to text files which are then read in by each separate test macro (assuming I can add a hold to the macro that ensure the pre-processing completes before any tests...)?

 

Many thanks

 

JordanB
Alteryx
Alteryx

Hi @johnyarham

 

I think adding text outputs would be a good solution. I have seen in the past calling upon certain macros within a workflow (test macros) based on the name of a input files (text outputs).

 

I have uploaded a sample workflow to dropbox which shows how to call upon macro based on the name of the outfile file and pass that into the appropriate macro within a workflow. 

 

To ensure these are completed before passing the data on you could look to use the events tab to run one module after another.

 

Best,

 

Jordan Barker

 

 

 

 

 

johnyarham
5 - Atom

Hi Jordan,

 

Thanks! I will look at setting the workflow up like this and see how I get on. 

 

Cheers

Labels