Skip to main content
Question

Writer output folder


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

11 replies

gio
Contributor
Forum|alt.badge.img+15
  • Contributor
  • 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
  • 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
  • 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
Influencer
  • 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
  • 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
Influencer
  • 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
  • June 16, 2014
with Takashi's tcl script it looks like this:

 

(zoom in a bit...)

 

 


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

 

 

 

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

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

arthy
Contributor
Forum|alt.badge.img+8
  • Contributor
  • 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
  • October 29, 2016

@gio,

Please could share the script to perfom such task?

Thanks


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