I have a Powershell script which calls an Alteryx analytic app (wizard) and inputs a single parameter into it via an .xml - method used to do this is here.
The output tools in the Alteryx workflow are setup as relative paths to store outputs to an Input and Working folder which are a level above the app itself, e.g.:
..\Input\FileName.yxdb
If I open up the Alteryx workflow and run it, or run the app via the interface, it works absolutely fine and my outputs are stored correctly. However, running it through Powershell using the code,
$modules = "C:\Projects\2019\Modules"
cd $modules
AlteryxEngineCmd.exe .\Extract_Variables.yxwz .\_Version.xml
returns the following errors:
Error - ToolId 5: Cannot access the folder .\Input\.
Error - ToolId 15: Cannot access the folder .\Working\.
Error - ToolId 24: Cannot access the folder .\Input\.
Error - ToolId 26: Cannot access the folder .\Input\.
despite the relative paths working fine if run directly inside the workflow. Powershell will run the Alteryx workflow okay but it fails to save the outputs.
As a test, I moved the Input and Working folders to the same level as the app itself and this worked fine - the files save to these test folders - so it is as if Powershell doesn't understand the two dots to represent moving up a level. In fact, I can write
..............\Input\FileName.yxdb
and it would still output to the test Input folder I created alongside the Alteryx app itself. Anyone know why this is the case?
I found the problem to this which was a simple misunderstanding of syntax. My working directory is as follows:
- C:\Projects\2019
|-- Modules
|-- AlteryxEngineCmd.exe
|-- Extract_Variables.yxwz
|-- _Version.xml
|-- Input
|-- FileName.yxdb
|-- Working
The Alteryx wizard then needs calling in Powershell as follows:
$modules = "C:\Projects\2019\Modules"
cd $modules
AlteryxEngineCmd.exe Extract_Variables.yxwz _Version.xml
Notice there is no need for .\
when calling the wizrd and the .xml file. Using .\
will successfully call the module but effects relative paths set within it.