Community Spring Cleaning week is here! Join your fellow Maveryx in digging through your old posts and marking comments on them as solved. Learn more here!

Alteryx Designer Desktop Discussions

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

Replace Directory Input tool with Macro Input tool

VEDH
8 - Asteroid

Hi All,

 

I have created the attached Standard Macro and need to convert it to a Batch Macro.

 

The current macro takes input file from a path and if in case the file is missing from that path it would take a dummy file from another path so that the further workflow runs smoothly even if input data is missing.

 

I just wanted to replace the directory input tools with macro input tool to make it a generic macro, which can be used in any workflow.

 

VEDH_1-1624452850939.png

 

Desired result: I would place 2 directory input tool, connect it to a batch macro (the macro would have 2 input anchors and 1 output anchor) and get output.

8 REPLIES 8
DawnDuong
13 - Pulsar
13 - Pulsar

Hi @VEDH 

If you only want to develop a generic macro that can take in any input, you can just replace the directory tool with a macro input tool.

you only need batch macro if you want to repeat the same set of procedures to a fixed list of instances.

if you have not done so yet, highly recomend:

- interactive lessons on Macro (one of the the bes in my opinion)

- the recorded 3-part videos on macro.

dawn 

AkimasaKajitani
17 - Castor
17 - Castor

Hi @VEDH 

 

If you use the Directory tool to avoid the missing file, you should use the Batch macro.

But if not, you can use the normal macro. In this case, you have to modify the workflow. 

 

Batch Macro :

 

You have to add the Control Parameter tool and Action tool.

 

AkimasaKajitani_0-1624455606035.png

 

Action tool setting:

 - Select the Red line "Directory - value" row.

 

AkimasaKajitani_1-1624455685449.png

 

If you want to use normal macro, the workflow will be more complicated.

In this case, you can use the FileExists function of formula tool to confirm whether the file path is correct.

VEDH
8 - Asteroid

Hi @DawnDuong,

Already tried replacing the directory tool with a macro input tool. It did not work, I get 3 input anchors. Please refer the attached workflow.

 

PS: Tried all the combinations of macro input.

DawnDuong
13 - Pulsar
13 - Pulsar

hi @VEDH 

from what you described about the inputs, you don’t need a batch macro. Do you need to use a batch macro because you have an assignment on batch macro?

if you can visually illustrate what inputs you have and what desired outputs you want to get, the community can better help you. Especially what the “batch” in batch macro is supposed to do

I must admit i do not follow 100% what is requires.

dawn

VEDH
8 - Asteroid

Hi @AkimasaKajitani  and @DawnDuong,

I played around with control parameter a lot. However, could not get desired output when the file was missing from original location.

 

Do you need to use a batch macro because you have an assignment on batch macro? - No, I do not have any assignment on batch macro. I am Ok with any macro type.

 

Below is how I want my workflow to look like

Desired Result:

VEDH_0-1624619591572.png

 

 

Below is the current state:

VEDH_2-1624619764944.png

 

 

I want all the tools in container to be in a single macro. That's all.

DawnDuong
13 - Pulsar
13 - Pulsar

Hi @VEDH 

you can just convert the directory tools to input macros. Do not put any control parameter on the canvas. If a canvas has a control parameter, it is automatically recognised as a batch macro and then you will have +1 more macro input that looks like an inverted question mark. SomethiNg like this will do the trick. 

image.jpg

image.jpg

AkimasaKajitani
17 - Castor
17 - Castor

Hi @VEDH 

 

I modified your macro at two three point.

 

1. Macro Input should have minimum fields

 

If you set many unnecessary fields to the Macro input tool, you must set the wasted fields.  

If you set only required fields, you can set some fields.

AkimasaKajitani_0-1624634199015.png

 

AkimasaKajitani_1-1624634245463.png

 

2. If the macro have some input, you'd better to name the anchor(Using Anchor Abbreviation option).

 

AkimasaKajitani_2-1624634388119.png

 

AkimasaKajitani_3-1624634411867.png

 

What this tell us is that upper input is for dummy file. 

 

3. I changed from Batch macro to standard macro

 

Please check attached workflow.

VEDH
8 - Asteroid

Hi @AkimasaKajitani,

 

A ton of thanks to you.

I literally got frustrated trying multiple combinations of settings with all different tools.

So, what I understand now is I was adding too many fields in template input, which caused this error.

 

Thanks a lot once again. Could have a peaceful weekend now, lol

Labels