Hey there!
For renaming attributes you can look into the SchemaMapper. It's a rather complex transformer, but it can use a table from a source (in this case your CSV for example) to rename attributes, also based on a filter (for example, a feature type name).
https://community.safe.com/s/article/configuring-the-schemamapper-transformer?r=1807&ui-knowledge-components-aura-actions.KnowledgeArticleVersionCreateDraftFromOnlineAction.createDraftFromOnlineArticle=1
This article is a great place to start your SchemaMapping adventures.
For attribute removal in your Workspace you could use the BulkAttributeRemover 's regular expression capabilities to keep and/or remove attributes that you wish to remove. Simple example is Aggregating/concatenating a list of attributes you want to remove into one attribute and with a | as a separator. Feed that value into the BulkAttributeRemover to remove that selection of attributes for the coresponding feature. This does require using transformers like the Aggregator and a way to join(FeatureMerger / FeatureJoiner) the result on the corresponding feature.
Next to that, if the removal of attributes is only relevant for writing it to an output and keep your target file clean, you could use FME's Dynamic writing capabilities to write based on a preset schema from a chosen source (can be a file containing the schema, but also an existing dataset's schema).
https://community.safe.com/s/article/dynamic-workflow-tutorial-introduction
This article contains multiple tutorials to help you get started on that topic!
Good luck!
Pim
Hey there!
For renaming attributes you can look into the SchemaMapper. It's a rather complex transformer, but it can use a table from a source (in this case your CSV for example) to rename attributes, also based on a filter (for example, a feature type name).
https://community.safe.com/s/article/configuring-the-schemamapper-transformer?r=1807&ui-knowledge-components-aura-actions.KnowledgeArticleVersionCreateDraftFromOnlineAction.createDraftFromOnlineArticle=1
This article is a great place to start your SchemaMapping adventures.
For attribute removal in your Workspace you could use the BulkAttributeRemover 's regular expression capabilities to keep and/or remove attributes that you wish to remove. Simple example is Aggregating/concatenating a list of attributes you want to remove into one attribute and with a | as a separator. Feed that value into the BulkAttributeRemover to remove that selection of attributes for the coresponding feature. This does require using transformers like the Aggregator and a way to join(FeatureMerger / FeatureJoiner) the result on the corresponding feature.
Next to that, if the removal of attributes is only relevant for writing it to an output and keep your target file clean, you could use FME's Dynamic writing capabilities to write based on a preset schema from a chosen source (can be a file containing the schema, but also an existing dataset's schema).
https://community.safe.com/s/article/dynamic-workflow-tutorial-introduction
This article contains multiple tutorials to help you get started on that topic!
Good luck!
Pim
Thank you pimic! i managed to use map attributes in schema mapper to rename these attributes i listed in my csv.. but i couldnt find a way to process them seperately by another field. e.g. i only want the attribute a to be renamed to b when another attribute c = 1... and so on.. i tried to add in another filter in schema mapper but didnt seem to help...
Thank you pimic! i managed to use map attributes in schema mapper to rename these attributes i listed in my csv.. but i couldnt find a way to process them seperately by another field. e.g. i only want the attribute a to be renamed to b when another attribute c = 1... and so on.. i tried to add in another filter in schema mapper but didnt seem to help...
Sounds like you're almost there!
You can use the filter option in the SchemaMapper to filter and then the attribute map will only take place where the filter is true. The filter does need the filter attribute name to be in the mapping document.
I've set up a sample here;
My goal here is to map the OldAttributeName to the NewAttributeName based on the value in the attribute Fruit, where the values equal the value in the column FeatureType.
This is what my dummy input data looks like;
So mapping this based on the mapping table translates to the following setup in the SchemaMapper:
Two actions set up, with action 1 being the filter:
This now checks if the Value in my column FeatureType is in the Attribute Fruit. So you reference the column that contains the attribute name, and the value that should be in that attribute.
If this is true, it is going to map the OldAttributeName attributes to the NewAttributeName attributes like this;
(note: if you want the old attributes to be removed, you can check that remove box)
Now the output looks like this:
I've attached a screenshot of the Feature Information window from the Visual Preview, since the mapped attributes will be unexposed:
As you can see, the attribute names get mapped to a different name based on the value in the attribute Fruit!
Hope this helps!
Pim
Thank you pimic! i managed to use map attributes in schema mapper to rename these attributes i listed in my csv.. but i couldnt find a way to process them seperately by another field. e.g. i only want the attribute a to be renamed to b when another attribute c = 1... and so on.. i tried to add in another filter in schema mapper but didnt seem to help...
Thanks Pim this perfectly solved my issue. i been trying but didnt quite get the idea of filter attribute name... i been giving an random name there but after reading your explanation it made it clear! thank you! ^.^