Question

using scripted prarameter to return windows directory path

  • 24 January 2023
  • 3 replies
  • 1 view

Badge

Hi,

I have a workspace that needs to read data from a variable folder and write to that same folder. However the exact folder name is not given but rather depends on two parameters (BEKnr and Model) that are entered at the start of runing the workspace but also includes a part that is not exactly known and can vary (versionnumber, v*).

To read the data I can easily use * for this variable but for the writer this is not working.

For instance: I need data to be read from tis folder; G:\\Team_Hydrologie\\FEWS\\ATTRIBUTENTABEL\\11_Maas\\Dommel\\v2_FEWS. Using an attribute creator and feature reader referring to the location as: $(FME_MF_DIR)\\$(BEKnr)\\$(Model)\\v*_FEWS I get the reader to work.

But to write to this same folder the use of the * doesn't work. (To be clear, there will always only be one folder that fits the criteria above, only one folder will have the _FEWS suffix. )

How can I do this? Without the user having to indicate the exact folder

I was thinking of using a scripted parameter but I am not familiar enough with python to get this working.

Can you help setting up the python script or maybe you have another solution?

Thank you,

Neel


3 replies

Userlevel 3
Badge +26

If you expose the format attribute fme_dataset, it should contain the directory path of the data that is read in.image

Badge

Hi,

But I would like it to be in a parameter, not in the attributes. Tho make it accessible all over the workspace. Is there a way to do this? (Sort of a reverse parameterfetcher)

 

Userlevel 3
Badge +26

Hi,

But I would like it to be in a parameter, not in the attributes. Tho make it accessible all over the workspace. Is there a way to do this? (Sort of a reverse parameterfetcher)

 

I would look into the VariableSetter and VariableRetriever.

Reply