Question

How do I set a writer destination using an attribute

  • 11 August 2014
  • 7 replies
  • 12 views

Userlevel 4
Badge +13

Hi Folks,

 

I'm having a bit of a moment. I know this is possible and have done it before, but can't remember how nor find out how from the docs.

 

 

I have a text writer. I'd like to set its destination using an attribute.

 

So:

 

 

fme_writer_dest = "c\\:thisdir\\filename.txt"

 

 

How do I do this?

I don't want to use fanout due to its limitations for my scenario.

 

 

Anyone know what the attribute name is?

 

Thanks.

7 replies

Userlevel 4
Hi,

 

 

a fanout is usually the best solution for this. But be aware that there are two types of fanouts: I suspect a dataset fanout will do the trick for you.

 

 

David
Userlevel 4
Badge +13
Hi David,

 

Thanks but I'm afraid fanout is suboptimal.

 

 

Dataset: This fanout type is poorly optimised within FME. What happens is that FME places the ENTIRE dataset into RAM before writing anything. I'm doing this to a large dataset so this is undesired. To minimise this I'm using a lot of writers and a testFilter with them - the first writer being the one that gets the most features.

 

 

FeatureType fanout - doesn't seem to be available for the Text file writer.

 

 

Thus my desire to set the writer destination using an attribute. I've just forgotten what the attribute name is, hence my question.

 

Cheers,

 

Jonathan
Badge +3
maybe use the parameters for this?

 

 

DestDataset_{somefileformat}.

 

Directory Output.

 

 

You can set one or if u have a writer of some sort inserted, rightclick in the navigator and "edit user parameter definition".

 

 

U can use a workspacecaller, to set the parameter(s)values
Userlevel 4
Badge +13
Hi Gio,

 

Sorry changing the parameter isn't an option. I need to use a name that I can dynamically update based on an attribute within the workspace itself.
Badge +3
I understand that, thats why i suggested paramters and workspacecaller combo. That is a dynamic set-up.

 

 

Or are workspacecallers out of the question in your set-up?
Userlevel 4
Badge +13
What's a workspacecaller? Are you referring to the workspaceRunner? I'm already using one of them (this is the runnee), I'd rather not need to go another level down.

 

Thanks,

 

Jonathan
Badge +3
Well.

 

The level where u create the attributes from wich you'd like to dynamically set up the target directory...should call the writer level, yes.

 

You dont want to fan-out, so is'nt this your option?

 

 

Yeah im still in the habit of calling them Callers...i must adapt..

 

 

There is a way to set parameters dynamicaly using Python or Tcl of course..

 

( if  i'm not mistaken, there is a post here about that somewhere june or july)

 

 

Any wich way, apart from fan-outs, involves setting parameters.

 

 

btw. AttributeFilewriter can write based on a created attribute targetstring to txt/csv. Just use append. And a start-up to check existence of file.

Reply