Skip to main content
Best Answer

Is it possible to remove hidden attributes without having to expose them first?

  • July 20, 2017
  • 6 replies
  • 417 views

ebygomm
Influencer
Forum|alt.badge.img+46

Transformers such as the matcher appear to use hidden attributes to match on when the attribute matching strategy is set to match all attributes. Is it possible to remove hidden attributes without exposing them first?

Best answer by david_r

You're right, it seems like the fme_* attributes enjoy some special protection by the BulkAttributeRemover.

Try this Python script in a PythonCaller instead:

import fmeobjects
def RemoveFMEAttributes(feature):
    for attrib in feature.getAllAttributeNames():
        if attrib.startswith('fme_'):
            feature.removeAttribute(attrib)

Tested with FME 2017 and seems to do the job.

This post is closed to further activity.
It may be an old question, an answered question, an implemented idea, or a notification-only post.
Please check post dates before relying on any information in a question or answer.
For follow-up or related questions, please post a new question or idea.
If there is a genuine update to be made, please contact us and request that the post is reopened.

6 replies

david_r
Celebrity
  • July 20, 2017

You can use the BulkAttributeRemover.


ebygomm
Influencer
Forum|alt.badge.img+46
  • Author
  • Influencer
  • July 20, 2017

You can use the BulkAttributeRemover.

 

Doesn't appear to let you remove any hidden attributes that start with fme_

david_r
Celebrity
  • Best Answer
  • July 20, 2017

You're right, it seems like the fme_* attributes enjoy some special protection by the BulkAttributeRemover.

Try this Python script in a PythonCaller instead:

import fmeobjects
def RemoveFMEAttributes(feature):
    for attrib in feature.getAllAttributeNames():
        if attrib.startswith('fme_'):
            feature.removeAttribute(attrib)

Tested with FME 2017 and seems to do the job.


takashi
Celebrity
  • July 20, 2017

You're right, it seems like the fme_* attributes enjoy some special protection by the BulkAttributeRemover.

Try this Python script in a PythonCaller instead:

import fmeobjects
def RemoveFMEAttributes(feature):
    for attrib in feature.getAllAttributeNames():
        if attrib.startswith('fme_'):
            feature.removeAttribute(attrib)

Tested with FME 2017 and seems to do the job.

There is an extremely convenient method if you want to remove every fme_* attribute :-)

 

def removeFMEAttributes(feature):
    feature.removeAttrsWithPrefix('fme_')

 


takashi
Celebrity
  • July 20, 2017

Alternatively, the FMEFunctionCaller with this function call setting could also work fine.

@RemoveAttributes(fme_pcre_match,^fme_)

thejando
Contributor
Forum|alt.badge.img+4
  • Contributor
  • September 11, 2019

You're right, it seems like the fme_* attributes enjoy some special protection by the BulkAttributeRemover.

Try this Python script in a PythonCaller instead:

import fmeobjects
def RemoveFMEAttributes(feature):
    for attrib in feature.getAllAttributeNames():
        if attrib.startswith('fme_'):
            feature.removeAttribute(attrib)

Tested with FME 2017 and seems to do the job.

...and don't forget about the "multi_reader_*" FME feature attributes, and the format-specific attributes like "geodb_*" for Esri Geodatabases. Also beware of the OBJECTID and SHAPE.LEN and SHAPE.AREA if they have been accidentally included in the User Attributes for some Esri formats.