Skip to main content
Question

select features by user-parameter specified attribute value

  • October 10, 2017
  • 5 replies
  • 243 views

hello everybody,

i have a stream of features which i would like to filter by an attribute value. i used the attributefilter for it and it works if i preset it to the attribute values i want to filter by. it doesnt totally work though if i create a user-parameter instead of a preset value. it doesnt show me an output for the user-parameter. I attached some screenshots of my problem.

Is it essentially possible to do that or should i try another approach?

thanks,

andi

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.

5 replies

danilo_fme
Celebrity
Forum|alt.badge.img+51
  • Celebrity
  • 2077 replies
  • October 10, 2017

Hi @andi_kraus,

1) Create Publish Parameter - Type = Attribute Name

2) Select into transformer AttributeFilter your published parameter: _attribute

3) Run the workspace and choose the attribute that you want filter.

Please, say me if its works in your case.

Danke,

Danilo


dustin
Influencer
Forum|alt.badge.img+31
  • Influencer
  • 629 replies
  • October 10, 2017

I'm not sure there is a way to dynamically update the AttributeFilter, since FME would not know where to send each feature that matches at run-time (because the connection would not be there at run-time).

You can set up the user parameter as a Text (multiline), and then you could atleast send all features that contain the provided user parameter to a single port in a TestFilter for further processing. See the attached for example.

Note: With this approach, spelling errors/spelling case differences could produce unexpected results. StringCaseChanger could possibly be used to alleviate some of this.


mark2atsafe
Safer
Forum|alt.badge.img+56
  • Safer
  • 2554 replies
  • October 10, 2017

Right, as @cartoscro says, if one of the ports in the dynamic list was "roads" for example, then how does FME know where to redirect roads to? What does it connect to? How do *you* know where it connects?

If you can figure that out, then perhaps a SchemaMapper will help? You keep a list of the potential future values, map them to a fixed value (say roads and rail = 1 because they are transportation) then you add an AttributeFilter to filter by the known, fixed values (eg 1,2,3,4).

Then you can connect 1,2,3,4,etc to where you know they need to go.


  • Author
  • 2 replies
  • October 12, 2017

I'm not sure there is a way to dynamically update the AttributeFilter, since FME would not know where to send each feature that matches at run-time (because the connection would not be there at run-time).

You can set up the user parameter as a Text (multiline), and then you could atleast send all features that contain the provided user parameter to a single port in a TestFilter for further processing. See the attached for example.

Note: With this approach, spelling errors/spelling case differences could produce unexpected results. StringCaseChanger could possibly be used to alleviate some of this.

Hey @cartoscro,

 

this is pretty close to what i mean. You say in your Test Condition of your TestFilter, the Right Value is @Value(attr_name). Can you put somthing like a list or a user parameter in there? Something like this: @Value($ListOfAttr)

 


dustin
Influencer
Forum|alt.badge.img+31
  • Influencer
  • 629 replies
  • October 12, 2017
Hey @cartoscro,

 

this is pretty close to what i mean. You say in your Test Condition of your TestFilter, the Right Value is @Value(attr_name). Can you put somthing like a list or a user parameter in there? Something like this: @Value($ListOfAttr)

 

If your input data has a list attribute structure, you can call out specific instances of the list with @Value(_list{0}._attr_name), @Value(_list{1}._attr_name), etc. From there you could build upon the TestFilter clauses with the number of potential list elements.