Question

Creating three output ports in one featurereader when reading in three csv files

  • 26 February 2024
  • 3 replies
  • 35 views

Userlevel 1
Badge +7

Hi forum,

 

I’m trying to do something I successfully used many times before. But for some reason it’s not working this time. I’ve delved into it and done research but I can’t work it out. It’s a really simple thing. 

 

I just need to read in three csv files with identical schemas into one FeatureReader.

 

I have a Creator, connected to a FeatureReader.

 

In the FeatureReader I’ve selected CSV as the format. In Dataset I selected the three dots (…), browsed to the data source location and then selected the three files. So, now in Dataset I have this:

 

"E:\FME temp source data\Scratch\TestPoints\one.csv","E:\FME temp source data\Scratch\TestPoints\three.csv","E:\FME temp source data\Scratch\TestPoints\two.csv"  

 

In FeatureReader I have ‘One per feature type’ selected in Output ports.

 

But, when this is read in, only one output port is created in the FeatureRader. That one output port is called csv and it includes all the records from the three inputs in the one output.

 

How do I force it to create three output ports from the three input CSV files?

 

Thanks,

  


3 replies

Userlevel 3
Badge +26

All CSVs regardless of the name of the CSV will be assigned ‘CSV’ to the fme_feature_type. This is the nature of reading the CSV file format in FME. So, one output port is expected. Other file formats such as shapefile, the fme_feature_type is assigned the name of the file itself. So that format would work for what you are wanting to do.

If you are set on only using one FeatureReader, I would look into an AttributeExposer where you could expose the fme_basename format attribute which would store the name of the CSV. From there you could TestFilter or AttributeFilter to get your 3 separate outputs.

Otherwise, I’d probably just use 3 FeatureReaders.

Userlevel 1
Badge +7

Thanks for the response.

 

It turns out to be that I needed to tick the relevant source files in Constraints>Feature Types To Read. 

Doing that gives me the separate output ports.

 

Thanks,

 

Userlevel 3
Badge +26

Thanks for the response.

 

It turns out to be that I needed to tick the relevant source files in Constraints>Feature Types To Read. 

Doing that gives me the separate output ports.

 

Thanks,

 

Learn something new every day!

Reply