I am reading in several datasets from a SQL database and writing them to a geodatabase. In some of these datasets there are duplicate attribute names (or what a gdb would consider duplicate due to the case e.g. Geom_AREA and GEOM_AREA).
Is there a way in FME to dynamically identify duplicate names and either delete or append a number to the end of them? Ideally this needs to be able to handle datasets where the duplicate attribute names are unknown before running through the workflow.
-
Duplicate Filter docs.safe.com/fme/html/FME-Form-Documentation/FME-Transformers/… and StringConcatenator docs.safe.com/fme/html/FME-Form-Documentation/FME-Transformers/…Mapperz– Mapperz ♦2025年02月06日 22:11:42 +00:00Commented Feb 6 at 22:11
1 Answer 1
Yes, by reading and manipulating "Schema" Features. Reading the SQL Server Schema with say a FeatureReader set to "Schema Only" output, will output 1 Feature per Table with all the Field Attributes (such as Field Name) in a List attached to each Feature.
Passing this into a ListExploder will give 1 Feature per Field, for which duplicate Field Names can be found that ignore Case (using say StringCaseChanger + DuplicateFilter) or similarly any particular field name patterns found with a Tester with RegEx test expression patterns.
The manipulated Schema of Original Field Name Revised Field Name vs can then be written into an Eg. External CSV file created with TempPathNameCreator into FeatureWriter, and then this file be used as the input to a SchemaMapper to translate the Data SQL Server Features into the new Schema, and similarly the manipulated Schema Features by rebuilt into revised Schema Features using ListBuilder to build the revised Field Names back into one Attribute List per Table, and these modified Schema Features be used to dynamically set the Writer Schema through Dynamic Writing.
As an aside though, you will get a much better response on the more active FME forums however!