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.

Macro with generic input anchor?

mst3k
11 - Bolide

Background: I made a macro a user can drop in a workflow, they enter a folder path in a textbox and it deletes all those .bak files Alteryx automatically drops in that particular folder.

The macro needs no inputs from the workflow, the user just types in the folder into the tool configuration. I prefer this to having to push it through a field in the workflow.

Now, ideally I'd like this tool to run last in the workflow so it deletes any .bak files created during the current run too. That means a block until done, which means it needs an input anchor. But both a control parameter and a macro input force the tool configuration to have a user select a field to pass into the macro. That's an extra unnecessary step, and here it may confuse the users because that field isn't going to do anything, it's irrelevant to the macro. I have to explain to them "pick some field from your workflow but it won't do anything" and that is not ideal.

Is it possible to make a macro that has a generic input anchor like a Formula tool does, where I can just connect it in the workflow stream and not have to select some field in the macro configuration?

 

8 REPLIES 8
Jonathan-Sherman
15 - Aurora
15 - Aurora

Hi @mst3k,

 

You could turn off the "Show Field Map" checkbox to remove the field selection requirement for the input anchor? 

 

Jonathan-Sherman_0-1605543549246.png

 

If this solves your issue please mark the answer as correct, if not let me know!

 

Regards,

Jonathan

 

atcodedog05
22 - Nova
22 - Nova

Hi @mst3k 

 

Is there any reason why you need to use control parameter. I think you can use a standard macro for this.

 

Because like @Jonathan-Sherman mentioned turn off field mapping can be used if you are using macro input tool

atcodedog05_2-1605544598192.png

But if you are using control parameter (i,e macro as batch macro) Control parameter doesn't have a option to turn off field mapping. It has a mandatory field mapping.

atcodedog05_3-1605544657277.png

 

Hence the suggested solution would be covert macro to standard macro and turn of field mapping on Macro Input tool.

 

Hope this helps 🙂


If this post helps you please mark it as solution. And give a like if you dont mind 😀👍

 

mst3k
11 - Bolide

Ah I overlooked that field map selection!

OK - that got me half way there. Now I can make an optional input anchor to connect to, and it doesn't prompt in the configuration for a field from the workflow (note to the other reply, yes I am doing a standard macro).

 

So now I have a new interesting problem. The tool no longer works as a standalone, even though I made the input optional and it's not actually being used for anything inside the macro. Workflow image pasted below, the Macro Input does nothing, the text box prompt is driving the work. Again, it worked just fine before I had the Macro Input (I just had a dummy text input there instead, and the resulting macro had no anchors). And it works fine if I connect anything to the macro in a regular workflow I'm using it in. But it doesn't work if I don't connect something to the optional input. Does that many any sense?

 

The error comes from the run command tool. It tells me it can't find the bat file to execute (and gives the correct path). So it appears it's failing to do the Write Source step of the run command. I don't see why the optional input which does absolutely nothing would cause the macro to break if nothing is connected to it in a regular workflow?

 

mst3k_0-1605548818629.png

 

atcodedog05
22 - Nova
22 - Nova

Hi @mst3k 

 

Have you given the text input properly. Thats the one giving the path of the file.

mst3k
11 - Bolide

Yup everything else works fine. If I use the tool in a simple workflow, it does not run if I don't connect something to it, but if I connect a random garbage input to it, it runs and works as intended

 

mst3k_0-1605549505130.png

 

 

 
 

 

 

 

mst3k
11 - Bolide

I can only post 1 image in a reply at a time I guess.

Here's the successful run, with no changes except a worthless dummy input attached to it

 

mst3k_0-1605549693636.png

 

atcodedog05
22 - Nova
22 - Nova

Hi @mst3k 

 

if its ok can you share the files. I can take a look into it 🙂

mst3k
11 - Bolide

There's no protected data in them or anything, I just wasn't sure if a network folder path could expose server names or something that I'm supposed keep hidden so I blurred them 🙂

 

Here's the workflow for the original macro, and it works just fine like this but there's no input anchors so I can't put it after a block until done. It's not the end of the world, every time it runs it deletes any previous .BAK files from whatever folder, but since that executes first it always leaves any new BAK files created by the current run until the next run deletes that one. 

I tried replacing the dummy text input at the beginning with a Macro Input, I made that optional, hid the field map, and in the text input of the Macro Input configuration I just put "dummy" in Field1. That puts the input anchor on my macro, which then leads it to only work in a regular workflow if something's connected to it.

 

Since it's a Run Command tool, it's writing out the cmd code to a file, and then executing it. So my folder path there wouldn't work for you, I replaced it with a placeholder "PUTYOURFOLDERHERE" in the 2 values of the run command tool, just replace that with something on your end to get it to work.

Labels