I've seen some people use ..\ (dot dot backslash) in file paths to create dynamic inputs and outputs, but I can't find any documentation or questions for how ..\ functions or why you might use multiple of these in a row, such as ..\..\..\dir\file. So, my question is:
How is ..\ defined?
Specifically, I'm curious about:
Solved! Go to Solution.
Hi @Inactive User,
The starting point for the relative path is the location of the Alteryx workflow. I hope my explanation is sufficient for you to understand it better.
Hello @Inactive User ,
Relative pathing is always relative to the workflow you are running. And if the workflow references a macro, the relative paths within the macro will be referenced to the macro path, not the workflow. Therefore if you have a workflow for example on:
C:\Users\IronMan\Documents\Mark42\Myworkflows
..\ will look for files on
C:\Users\IronMan\Documents\Mark42
If you add another ..\..\ it will look for files in
C:\Users\IronMan\Documents
For example
..\Mark45\Myworkflows\Secret_macro.yxmc
Will look for a macro on
C:\Users\IronMan\Documents\Mark45\Myworkflows\Secret_macro.yxmc
3.- Never used it before
4.- Cannot think of an example where two files would meet the criteria, this would mean that two files have the same name on the same path?
Regards
Hi @Inactive User
What both the other commenters have implied is that ..\ references the directory above the current directory. Move up one directory for each "..\", as in the first part of @afv2688 explanation.
To answer your question 3, "..\OneDrive\..\Project XYZ\file.csv)" is valid and would move as follows assuming this directory structure
parent --- Current
--OneDrive
--Project XYZ
1) ..\ moves up to parent
2) OneDrive\ down into OneDrive
3) ..\ Back up to parent
4) Project XYZ\file.csv down into Project XYZ
If you follow this you'll see that the directory 1) is the same as directory 3) so any sequence like ..\directory\..\ is redundant and can be removed and replaced with a single ..\
Question 4. There is never any ambiguity since the paths will always resolve to a unique location on the drive or will be invalid.
Dan
Hi @danilang,
I wasn't aware that the 3 scenario is valid.
Thank you for a detailed explanation.
@Inactive User there is also a help page on this topic. It might be useful for you to visit it:
https://help.alteryx.com/current/designer/workflow-dependencies
I have been able to get macros to use the working directory of the parent workflow before. For some reason, this has now stopped working and I'm trying to find out how to get it working again. I have a generic file reader that reads a file in using a file reference relative to the workflow location.