Skip to main content
Question

Textfile Reader

  • 6 February 2013
  • 5 replies
  • 15 views

I have a reader which reads textfile from a specified directory.

 

 

I don't want to have to specify the textfile each time I run the job.

 

 

Can I simply set up a directory published parameter and use this for the reader to process any textfiles within that directory. If it can be done how do I do it.

 

 

Thanks
Hi,

 

Simply go to the advanced browser (barrel) point to the directory (you can edit the filter to *.txt, if necessary) and thats it (since the source is automatically published).
Though if your text files all have different names, which is likely, you'll need to go to your Source FeatureType on the workbench canvas and click the Properties button, then select the tick box to "Merge Feature Type" on the wildcard *. Itay's part allows you to read many txt files, this part allows different file names other than the one defined to pass through the workbench with the benefit of just having one input featuretype on the canvas, rather than 1 per text file...
I have created a published parameter as type Directory (Source) and linked this to the source text file(s) of the reader but I'm getting 'error reading

C:\\Documents and Settings\\CS804PI\\Desktop\\Data Extract

'
I forgot to say that there will only be one textfile per run but the textfile name will be different each time.

 

Thanks
Itay's answer should be fine for you then. If there is just 1 file in the folder each time, having the reader set to read from FolderA and *.txt will mean that as soon as your file is available to process you just trigger the workspace to run, not workspace editing required.

Reply