I have a table with attributes containing a suffix of the form _DIGIT. FME displays the table like this:

country name_0 name_1 name_2 platforms_0 platforms_1 platforms_2
The Netherlands Utrecht Centraal Amsterdam Centraal 16 11
France Gare du Nord 32
Germany Hamburg Hbf Munich Hbf Frankfurt(Main) Hbf 12 32 29

But I need it ordered like this:

country name_0 platforms_0 name_1 platforms_1 name_2 platforms_2
The Netherlands Utrecht Centraal 16 Amsterdam Centraal 11
France Gare du Nord 32
Germany Hamburg Hbf 12 Munich Hbf 32 Frankfurt(Main) Hbf 29

Where the attributes are ordered by their suffix _DIGIT and the ones not containing the _ suffix in front. Using the AttributeManager is no option since the length of the suffix sequence can range up to 106 items and is variable every time I run the workspace. The Sorter only sorts the features inside the attributes, but not the attributes themselves. Perhaps a schema could help, but I have no clue how to work with those.

I'm using FME Workbench 2021.2

1 Answer 1


Assuming you want to fix the order in the output file, not in workbench.

  • Use an AttributeCreator to set a Schema Definition Name. (For example, fme_feature_type_name = StationsByCountry)
  • Use a SchemaScanner to get a Schema Feature. Select fme_feature_type_name as Schema Definition Name, set attributes to ignore to "fme_" which will prevent the FME technical attributes contaminate your output.
  • Use a ListSorter on the Schema Feature, sort on attribute{}.name.
  • Connect the Schema Feature and the Data Features to a Sorter to make sure the Schema Feature is the first one.
  • Connect the Sorter outputport to the FeatureWriter inputport.
  • In the FeatureWriter, check the Dynamic Schema Definition checkbox, set Feature Type Name to fme_feature_type_name.
  • In the tab User Attributes, remove all attributes.
  • Run workbench.

sample workspace

  • Thanks for the answer. I'm still a bit puzzled by how it works. Where do the 'real' features come in? all the way to the end where the FeatureWriter has an outputport?
    – saQuist
    Commented Feb 7, 2023 at 14:13
  • The real features go into the SchemaScanner, out from the Outputport of the SchemaScanner, via the sorter into the FeatureWriter. The first 2 transformers are used to create dummy data, these you replace with your data. Commented Feb 7, 2023 at 15:37
  • Did you get this to work or do you need any more help? If you ask this question on the safe forum I can provide a working sample. Commented Feb 10, 2023 at 10:48
  • Okay, I got it to work, the attributes are not sorted on suffix
    – saQuist
    Commented Feb 16, 2023 at 12:22
  • It worked for me using your data sample. Once you have the Schema Feature, you can explode the list to features, sort as you want and rebuild the list in the order you need. Commented Feb 16, 2023 at 15:39

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.