Skip to main content
Question

How to set up a config for readers and writers that refer to files in a folder.


I have several fmw files that read and/or write to a particular folder structure. But sometimes the location of the folder structure changes servers. So i'm wanting a way to set a root variable for readers/writers so i only have to update the one variable instead of updating all fmw readers/writers.

 

--------------------UPDATE--------------------

I need to add, my intention is to have one variable/setting/config that is globally available across all my workspaces. So changing one configuration would affect all workspaces.

For example, in a shapefile writer, the dataset location is d:\\folder\\to\\file.shp, but I'd like to change the location to something like $(GlobalVar)\\folder\\to\\file.shp. Where GlobalVar is available across all workspaces.

4 replies

caracadrian
Contributor
Forum|alt.badge.img+23
  • Contributor
  • January 25, 2021

You can setup a User Parameter of type Folder and use that in your Readers and Writers.

Folder Parameter


  • Author
  • January 25, 2021
caracadrian wrote:

You can setup a User Parameter of type Folder and use that in your Readers and Writers.

Folder Parameter

Setting this works well in the same workspace. I swapped to another workspace and couldn't find it, though. How can I get this parameter to be globally exposed across all workspaces?


david_r
Celebrity
  • January 25, 2021
joe101 wrote:

Setting this works well in the same workspace. I swapped to another workspace and couldn't find it, though. How can I get this parameter to be globally exposed across all workspaces?

Have a look at the suggestion from @nielsg​  here: https://community.safe.com/s/question/0D54Q000080hIbySAE/how-can-i-script-a-connection-parameter-with-python


caracadrian
Contributor
Forum|alt.badge.img+23
  • Contributor
  • January 25, 2021
joe101 wrote:

Setting this works well in the same workspace. I swapped to another workspace and couldn't find it, though. How can I get this parameter to be globally exposed across all workspaces?

Another way to do it is to store your path in a file (lets say .csv), read the file and join your data with the path attribute from that file. I am not a fan of scripts 😐

It's not the most elegant solution, it requires creating a join attribute on your data, longer processing time and to modify all your existing workspaces.


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