Question

select features by user-parameter specified attribute value

  • 10 October 2017
  • 5 replies
  • 58 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


5 replies

Userlevel 4
Badge +30

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

Userlevel 3
Badge +26

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.

Userlevel 4
Badge +25

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.

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)

 

Userlevel 3
Badge +26
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.

Reply