Advent of Code is back! Unwrap daily challenges to sharpen your Alteryx skills and earn badges along the way! Learn more now.

Alteryx Designer Desktop Discussions

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

Macro running prior than what was supposed to

andrefc
7 - Meteor

Hi Everyone,

I looked for this issue but I did not find any answer.

 

I built my own macro to open an Excel file and create a Table object. It is running as expected if I have a simple workflow but the problem is when this macro is running prior to the file being created. I tried to use "Block Until Done" and it is not working.

When I run my workflow, the first thing that is running is my poor macro...

 

What should I do in this case?

 

 

 

Alteryx - Workflow.jpg

7 REPLIES 7
andyuttley
11 - Bolide
11 - Bolide

Hi @andrefc 

 

That's strange. In my experience 'block until done' is really useful, though if I'm wanting to reference a file I'm writing to in the same workflow, I'd normally choose to break the process out into separate 'chained' processes. I do this using the Runner / Conditional Runner tools available in the CREW macro pack:

https://community.alteryx.com/t5/Engine-Works-Blog/Crew-Macro-Pack-2016-Q2-Release/ba-p/26482 

This will ensure the file is written before your macro tries to reference it (as they're completely separate processes)

- have you got these tools / have you used them before? 

 

If it's not possible to use the runner macros (CREW) - is it possible to include a version of your workflow, even with dummy data, to test and debug? Alternatively, I'm happy to send a runner tool example over if you've not used them before

Hope that helps

 

Andy

andrefc
7 - Meteor

Thanks for your quickly reply, @andyuttley!

 

I think I am doing something completely wrong with my macro. I am pretty new with Macros, but the only thing this guy does is, it calls a VBS file based on the input info, but I need this process to be in the middle of a workflow, so I need to have an input and output, so the workflow can continue without any problem.

 

The only way I was able to do this without any interference was connecting the Macro Input directly to the Macro output... Is there any other way to get it solved?

 

Appreciate your help!

 

Alteryx.jpg

andyuttley
11 - Bolide
11 - Bolide

no problem

 

Well you can still break multiple workflows out (i.e. your macro could be part 2 of a 3 part run, so it references the file from 1, but results of it are then used in 3) using the runner tools, if I've understood correctly. 

 

Are you able to download these additional tools? There may be a quicker way round it if I knew the wider workflow a bit better, but like I say, whenever I have files that need to be written then referenced, I'd normally break it out into separate 'chained' processes anyway, as the block until done tool isn't really meant for this. There's a great blog/thread on the tools here: https://community.alteryx.com/t5/Alteryx-Designer-Discussions/Using-the-Runner-Macro-Chaining-Workfl... 

 

Andy 

andrefc
7 - Meteor

Thank you for that, @andyuttley . I am already using Crew Macros and it works pretty well but I was trying to do everything in a single workflow.

 

What I don't understand is why when I run my workflow it starts right on this new tool I built instead of start running from the beginning. Does Alteryx doesn't follow the workflow? Is there anything I am missing?

 

Thanks again.

 

 

andyuttley
11 - Bolide
11 - Bolide
Sometimes a tool may look like it has kicked off running but this doesn’t always mean it’s processed everything, I think it is sometimes just checking config for example

Is the error you’re getting definitely because the file being written in (1) output of Block has not yet been written? Does this mean when you run the workflow a second time (or the macro on its own) it potentially works (because the reference file is there)?

I’d personally still break this out (have you tested this actually?), however, one thing to try might be to drop another redundant process in the (2) output of your final block tool: this could be a browse or even a “wait a second” tool, just so there’s an additional delay on kicking off your macro (now moved to output (3) of the block)
danilang
19 - Altair
19 - Altair

Hi @andrefc 

 

I think that the macro runs before the rest of the workflow because there's nothing to stop it.  Since the top stream, starting with the text input is not dependent on anything that comes from the main workflow(the bottom stream), it can run whenever.  

 

Try adding a blocking tool that will stop the top stream from running by linking it to the bottom.

blocking.png

Here the Append Fields tool will act as blocking tool essentially stopping the top stream of the macro until there is data available on the bottom.  To minimize the impact, the Sample tool takes only the first row from the bottom stream and the Select after it takes only one field, effectively adding one extra column to the top.

 

There are other, more elegant, ways to handle this, including moving the File browser to the main workflow and passing the file name into the macro, but this should work for you

 

Dan

 

andrefc
7 - Meteor

Thank you, @danilang !!

 

I tried to use Append right after running the C command but didn't work properly.

 

I changed a little bit your suggestion, using record count instead, so I don't need a specific column coming through the input and it's working as expected! Thanks again for your and @andyuttley help!

 

@

 

Alteryx - Workflow.jpg.png

Labels