The question is on using the [Engine.WorkflowDirectory] “constant” inside a macro. I would like it to return the directory of the macro, and not the directory of the workflow that called the macro. Or, I would like a work-around to accomplish the same thing: The macro needs to know where the end-user put the macro. (because I’m packaging dependencies with it, and relative references are not working).
To illustrate the issue, I have created a simplified example.
Download the YXZP, double click to extract / open.
Right click on the marco, select "Open Macro:...".
Run the macro once. Inspect the output.
The output is the location of the Macro. This is what I want! So far so good!
Close the macro. Now run the yxmd file “Call Example Macro.yxmd”. Inspect the output coming out of the S anchor:
The path shown is the path of the parent workflow calling the macro, not the path of the macro itself.
I’m developing a larger application that depends on knowing where the end user has put the macro.
So finally, my question… How do we develop a macro in which we can reference the macros location inside the macro itself?
If you’re wondering why I need this, it is a much larger conversation. So, I just wanted to post a boiled down example and see where the conversation goes.
Thanks for your support!
Solved! Go to Solution.
Hi @YEM
here is a workaround to get the location of the macro.
In Windows, the period (.) signifies the current directory. What is a period in Windows?
We can use the period in the Directory tool to pull a list of files in the current directory.
Alteryx will return the full path of the current directory too.
Then it is trivial to build a macro to output the information.
We can see the Directory output side by side with the [Engine.WorkflowDirectory]. [Engine.WorkflowDirectory] can be removed in production.
The macro is lightweight and can be placed into any of your macros.
I added the macro, the test workflow, and a packaged workflow too.
Exactly what I needed. Thanks!