Skip to main content
Solved

Understanding relative paths


I have a workbench set up on a desktop PC that is reading numerous data sets from folders on that computer. The workbench is also saved locally.

I have moved a copy of the data and workbench in the same folder structure onto our shared network where the start of the file path is different.

eg.

C:\\Data\\Workbench.fmw & C:\\Data\\Input\\Data.xls

becomes

P:\\Project\\Projectname\\Data\\Workbench.fmw &

P:\\Project\\Projectname\\Data\\Input\\Data.xls

 

How can I set up the workbench so I only need to change the folder path to data sources once, and all the others know that the relative path has changed?

 

Thanks!

Best answer by thomas_g

You can use nested Parameters. So create a new parameter e.g. PARAMETER1 with the beginning of the path like "P:\\Project\\Projectname\\" as a value and a second one e.g. PARAMETER2 where you use PARAMETER1 and the second part of the path or the filename like $(PARAMETER1)\\Data\\Workbench.fmw . Than you only need to change the value of the first parameter and you can use it like a variable.

Finally you have to put PARAMETER2 as the source-parameter of you input data.

View original
Did this help you find an answer to your question?

3 replies

thomas_g
Contributor
Forum|alt.badge.img+8
  • Contributor
  • Best Answer
  • April 9, 2019

You can use nested Parameters. So create a new parameter e.g. PARAMETER1 with the beginning of the path like "P:\\Project\\Projectname\\" as a value and a second one e.g. PARAMETER2 where you use PARAMETER1 and the second part of the path or the filename like $(PARAMETER1)\\Data\\Workbench.fmw . Than you only need to change the value of the first parameter and you can use it like a variable.

Finally you have to put PARAMETER2 as the source-parameter of you input data.


aron
Supporter
Forum|alt.badge.img+16
  • Supporter
  • March 23, 2023

Is this still the most convenient way to move workspaces between different computers?


graemebrown
Contributor
Forum|alt.badge.img+3
  • Contributor
  • September 11, 2024

Here’s an approach that is slightly less cumbersome, but only works if your paths of interest are subpaths of your workspace’s folder.

I was going to provide a “how-to” here, but while searching for the correct terminology, I came across this post from a few months ago that illustrates it well: FME_MF_DIR predefined parameter (macro) – FME Support Center (safe.com).

In a nutshell: after adding a reader or writer that refers to a file location, edit the automatically-created user parameter for the file’s path to be $(FME_MF_DIR)<subpath_within_workspace>; e.g. $(FME_MF_DIR)Input, or $(FME_MF_DIR)Output.


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings