Skip to main content
Question

Writer output folder

  • June 15, 2014
  • 11 replies
  • 138 views

Hello,

 

 

 I am new to FME, recently started to work on FME Desktop 2014. I am looking to convert any format to CSV. My requirement is to deposite output CSV to same input folder.

 

 

e.g. If user selects c:\\temp\\test.shp then test.csv should be written to c:\\temp\\folder.

 

 

Currently I am able to convert the file but I am not able to set output path same as input path.

 

 

I am not sure how to achieve this.Any pointers in the right direction will be appreciated.

 

 

Regards,

 

john
This post is closed to further activity.
It may be an old question, an answered question, an implemented idea, or a notification-only post.
Please check post dates before relying on any information in a question or answer.
For follow-up or related questions, 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.

11 replies

gio
Contributor
Forum|alt.badge.img+15
  • Contributor
  • 2252 replies
  • June 16, 2014
Hi,

 

 

Your input shapefiles have a parameter $(SourceDataset_SHAPE) (see navigator panel)

 

If u create a attribute directory_out or something after parsing it from this parameter.

 

 

Or you can use a driectory and filename reader. To  do samish.

  • Author
  • 55 replies
  • June 16, 2014
Thanks for your reply.

 

 

I can create directory_out attribute but how to assign it to DestDataset macro so that it will create csv in that folder.

gio
Contributor
Forum|alt.badge.img+15
  • Contributor
  • 2252 replies
  • June 16, 2014
Ah, i see.

 

 

create a scripted parameter (in my picture $out).

 

In the stringeditor of this scripted parameter you can make a link to the Sourcedataset.

 

You can extract the path in this editor, using regularexpression.

 

 

Then edit the parameter of the DestDataset_SHAPE and link it to the created parameter

 

 


takashi
Celebrity
  • 7843 replies
  • June 16, 2014
Hi John,

 

 

Agree with Gio on defining a scripted parameter.

 

I'll give an example. A Scripted (Tcl) Parameter with this script provides the directory path of the source dataset.

 

-----

 

return [file dirname $FME_MacroValues(SourceDataset_SHAPE)]

 

-----

 

Just be aware that this example is valid only when SourceDataset_SHAPE represents a single file path.

 

 

Takashi

gio
Contributor
Forum|alt.badge.img+15
  • Contributor
  • 2252 replies
  • June 16, 2014
another note i forgot to mention.

 

The definition of the $out parameter must be done prior to the referencing of this $out parameter.

 

This order you can set in the paramter section in the navigator panel, you can drag one above the other

takashi
Celebrity
  • 7843 replies
  • June 16, 2014
alternatively, you can also change type of DestDataset_SHAPE parameter to "Scripted (Tcl)" and then define a script directly for the parameter ;)

gio
Contributor
Forum|alt.badge.img+15
  • Contributor
  • 2252 replies
  • June 16, 2014
with Takashi's tcl script it looks like this:

 

(zoom in a bit...)

 

 


gio
Contributor
Forum|alt.badge.img+15
  • Contributor
  • 2252 replies
  • June 16, 2014
..lol..

 

 

 

Takashi is of course right..more efficient to directly script the DestDataset.

  • Author
  • 55 replies
  • June 17, 2014
Thanks Gio and Takashi... solution worked like charm.

arthy
Contributor
Forum|alt.badge.img+8
  • Contributor
  • 101 replies
  • October 28, 2016

Please could you provided the TCL script to define the folder output writer based on the file input reader name?

 

 

Thanks

arthy
Contributor
Forum|alt.badge.img+8
  • Contributor
  • 101 replies
  • October 29, 2016

@gio,

Please could share the script to perfom such task?

Thanks