Solved

Dynamic file names for Data Download service

  • 13 December 2012
  • 2 replies
  • 12 views

I have a workspace using a "Swiss Interlis" writer that produces an XML file. The writer takes the full path of the file from a parameter. I have linked this destination parameter to a Python scripted parameter that generates the file names dynamically depending on user input.

 

 

That workspace works fine in FME Desktop and as a Job Submitter service on FME Server. If I publish the workspace as Data Download service it fails with the error message: "The filename, directory name, or volume label syntax is incorrect" and also returning the source code of the Python parameter. It looks like the Python source code is used as a file path rather than running the script and using its result.

 

 

I changed the script to only return a filename instead of the full path, but I still get the same error message. If I enter a hardcoded file name into the writer destination parameter (instead of the Python script) everything works fine and the file name is used in the downloadable zip file.

 

 

Is there a way to set the file name inside the zip archive dynamically and how?
icon

Best answer by tino 17 December 2012, 12:57

View original

2 replies

Badge +7
Hi Juerg,

 

 

yes this is possible, but you do have to use "Dataset Fanout".

 

You can't link the XML-Writer to any FME Parameter, because the DataDownload Service will always overwrite ist. This is needed to allow concurrent usage of the service, every job instance writes to a unique folder.

 

 

Just have a look at my demo workspace : https://docs.google.com/open?id=0B50V-GKOTFBKakQ0ZnFYbzU5QVk

 

 

1. Create a private parameter FME_SERVER_DEST_DIR and activate Dataset Fanout on this parameter

 

2. Because you can only "Fanout on attribute" we have to use the ParameterFetcher in the process

 

3. For demo purposes (Python Parameter) i take the input from the user, reverse it and attach a file suffix: input : demo : => filename: omed.xml

 

 

Kind regards,

 

Tino
Hello Tino

 

 

Thanks for your solution. It works like a charm.

 

 

Regards

 

Juerg

Reply