Skip to main content

I have been developing a workbench to be used on different shapefiles via adding a new reader everytime, they would have slightly different attribute names beyond my control.

The workbench is now ready to go, but when I have to update the right attribute in a transformer, FME seems to list ALL the attributes that have been handled with previous files with that workbench.. It's really annoying and also potentially generating failures.

Is there a way to clear this? To only list the attributes within the readers?

I have tried tool>purge temporary files, but it hasn't solved it.

 

Not sure if I understand what you try to explain. Do you have multiple classic readers connected to the transformers in workbench? Then just remove all previous readers? Maybe add a printscreen so we can see what you try to tell?

 

Personally I don't use classic readers anymore, I read all my data using a Creator / FeatureReader combo, setting it Single Output Port / Generic and expose the attributes manually with an AttributeExposer. This is more intuitive and more in control.


It is hard to see what is the issue not knowing how your workbench is build up, but...

 

I think you don't use dynamic Readers and Writers (or dynamic FeatureReaders and FeatureWriters).

 

My SetupNote that features that come out of a generic port have no Attributes Exposed at all. But the Writer will write them because it knows the Scheme. So if you need to do something with an Attribute you will have to Expose them first

 


Thank you both for your suggestions, that's really good! I did have a go at it with your example + AttributeExposer and it's working.

However, I'm working with geospatial data, and I find it a bit tricky to use Shapefiles. It's ok with geojson, but when choosing the format Shapefile, nothing gets outputed at all. I can't find an example of a workbench that exports as shapefile using a feature writer.

The last piece of the puzzle is to be able to let 'the user' select a key attribute from a file to be used in the workbench. It works when setting up the user parameter directly, or as text, but is there a way to be able to select attribute from a freshly selected file? Just after clicking Run and selecting the user parameter?

I'd like the end product to be a neat *.fme file that let the user select an attribute from a selected shapefile


Thank you both for your suggestions, that's really good! I did have a go at it with your example + AttributeExposer and it's working.

However, I'm working with geospatial data, and I find it a bit tricky to use Shapefiles. It's ok with geojson, but when choosing the format Shapefile, nothing gets outputed at all. I can't find an example of a workbench that exports as shapefile using a feature writer.

The last piece of the puzzle is to be able to let 'the user' select a key attribute from a file to be used in the workbench. It works when setting up the user parameter directly, or as text, but is there a way to be able to select attribute from a freshly selected file? Just after clicking Run and selecting the user parameter?

I'd like the end product to be a neat *.fme file that let the user select an attribute from a selected shapefile

"However, I'm working with geospatial data, and I find it a bit tricky to use Shapefiles. It's ok with geojson, but when choosing the format Shapefile, nothing gets outputed at all. I can't find an example of a workbench that exports as shapefile using a feature writer. "

Don't understand what the issue is that you can't solve. The FeatureWriter expects a folder to be specified as Dataset and a Filename as Shapefile Name. Then it creates 4 or 5 files that you need when using Shapefile format.

 

"The last piece of the puzzle is to be able to let 'the user' select a key attribute from a file to be used in the workbench. It works when setting up the user parameter directly, or as text, but is there a way to be able to select attribute from a freshly selected file? Just after clicking Run and selecting the user parameter?"

If you use a dynamic way of working, FME will not know what your file looks like. So you can't let the user select an Attribute. Exept when you know the file will always have a few of the same Attributes. Then you can type those in the Exposer and/or the User Parameter Definition.


I'll probably need to not use shapefiles as output. It works great with geojson, it's dynamic, the attributes get loaded and outputed properly. With shapefile, the attributes are not outputed properly. I need an attribute exposer, and those need to be updated for every new shapefile.

am I wrong somewhere?

feature_readers_writersfeature_readers_writers_shp_error 


I'll probably need to not use shapefiles as output. It works great with geojson, it's dynamic, the attributes get loaded and outputed properly. With shapefile, the attributes are not outputed properly. I need an attribute exposer, and those need to be updated for every new shapefile.

am I wrong somewhere?

feature_readers_writersfeature_readers_writers_shp_error 

You could use a setup like this workbench:

DynamicAttributes 

Because of another forum question about merging Excel, this one is more complicated then needed for your question I guess. But it shows what is happening.

 

The workbench merges 2 files together, only exposing the merging attribute. Because we want all attributes from both datasets we create a Schema feature combining both Schemes.

 

The Schema attribute fme_feature_type_name should match the Writers Schema Definition Name. You could set the Shapefile Name to @Value(fme_feature_type) to generate the Shapefile name dynamic. And if you connect the Schema from the Reader directly to the Writer you could leave the Schema Definition Name blank 'Default from Shapefile name above'.

 

 

 

 

 


Reply