Question

DynamicAttributeUpdater

  • 27 March 2024
  • 0 replies
  • 8 views

Userlevel 4
Badge +13
FME Hub user chriswilson just uploaded a new transformer to the FME Hub.

Python caller that takes in 'attr_name' and 'attr_value' attributes, searches for attr_name in the incoming feature's attribute list and will update the values of any matched attributes.

Relies on firstly features being counted - hence also taking in a _count attribute that will be used to group features - and then all of their attribute names having been exposed as 'attr_name' and values as 'attr_value' in an AttributeExploder previously, then some other work having occurred to for example join or modify those attributes (e.g. mapping attribute values to domain codes) and also some tidying of that work so that duplicate records or null values are removed from 'attr_name' and 'attr_value', so that the result is you have at least some attributes from your original features that need to be updated but you don't know which ones that will be going into the process run. Hence this is a dynamic transformer.

For example in the process that led to this being created I exploded a dataset's features after running my data through a counter. For one of those feaures I found 3 attributes that needed their values mapping to domain codes (by comparing them against an XML schema I had read in that included fields and domains), then brought these 3 features into the python caller and used each 'attr_name' and 'attr_value' to find and update 3 attributes from the original feature and output only one feature. This acts to merge that original feature back into itself and dynamically update 3 of its attributes.



Would you like to know more? Click here to find out more details!

This post has been closed for comments