Question

How to only select attribute names for 'Attribute_List' parameter?

  • 20 February 2021
  • 2 replies
  • 25 views

Badge +3

Hi folks,

 

In some cases I get into the situation that I want to perform an action on all of the exposed attributes in my workspace. For example, filtering features for which at least one attribute has a value (this idea is linked to the idea 'https://community.safe.com/s/idea/0874Q000000j0VfQAI/detail' and my comment in the idea 'https://community.safe.com/s/idea/0874Q000000j0G6QAI/detail').

 

It would be nice to be able to quickly select all of these exposed attributes. If I make a custom transformer that uses the 'Attribute_List' type of parameter (either comma or space delimited), I am able to specify multiple attributes to perform an action on. However, when I want to configure the value for this parameter in the main workspace, the 'Select <PARAM_NAME> Items' window popus up, and there I can choose both the attribute names (indicated with the orange attribute arrow), as well as the attribute values (i.e. also options for '@Value(<ATTR_NAME>)' pop up in this window.

 

Therefore I'm still not able to quickly use the 'Select all' option to select all the attributes (or to be more precise, all attribute names), because I first need to deselect all the '@Value(<ATTR_NAME>)' records.

 

I was wondering, is this intended behaviour? and or is it possible to have only the attribute names show up in this pop up window?

I can imagine that in some cases it would be usefull to specify multiple attribute values in a parameter, but I would suppose that would be better suited for a different/dedicated parameter, and that seems to be a different question/idea alltogether anyway.

 

See also the below screenshot, and the attached dummy workspace.

P.s. I'm using FME version '2020.1.1.1' if this would be version dependent (I believe to have seen different behaviour for this parameter/window in the past).

Select_attributes_window_FME


2 replies

Badge +2

@thijsknapen​ I think I'd suggest using PythonCaller here and process a list of attributes there. You should be able to use FMEFeature.getAllAttributeNames() and fmeobjects.FMEFeature.getAttribute to recover the list of attributes and then get their values. Then build a test around that. See the docs.

Badge +3

Hi @Mark Stoakes​ , Wouldn't that be similar to the AttributeExploder transformer (with list output)?

I have two questions/concerns regarding that solution.

1) It seems to me that that methodology will present all attributes, and not only the exposed attributes in the workspace (i.e. also schema, format and/or fme attributes)

2) I'm not sure if it would be possible to mold that solution into a parameter for a custom transformer, so that the user can alter choice for the selected attributes in the main workspace, but maybe a python scripted parameter could work here.

Reply