Skip to main content
Solved

Dynamic file names for Data Download service

  • December 13, 2012
  • 2 replies
  • 47 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?

Best answer by tino

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
View original
Did this help you find an answer to your question?
This post is closed to further activity.
It may be a question with a best answer, an implemented idea, or just a post needing no comment.
If you have a follow-up or related question, please post a new question or idea.
If there is a genuine update to be made, please contact us and request that the post is reopened.

2 replies

tino
Contributor
Forum|alt.badge.img+16
  • Contributor
  • Best Answer
  • December 17, 2012
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

  • Author
  • December 17, 2012
Hello Tino

 

 

Thanks for your solution. It works like a charm.

 

 

Regards

 

Juerg

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