Skip to main content

Hello,

 

 

I am trying to achieve an apparently simple task: using the Tester, I want to Pass only the feature names that are in a list of names.

 

 

I have extracted the unique values from an attribute and concatenated that list into a field named "_concatenated". Both the ListConcatenator and the reader are entering the "Tester" transformer.

 

 

I then try to use the Tester by using "NAME in _concatenated" where "NAME" is the LeftValue and "_concatenated" is the RightValue.

 

 

For some reason, nothing passes. If I enter in the RightField the value of the "_concatenated" box, it works.

 

 

Not Working:

Working:

Have you tried _concatenated CONTAINS NAME?


Have you tried _concatenated CONTAINS NAME?

Yes. Same result, all fail. I would expect both to work though. Very strange.

 

 


robertr

That does not work with a attribute as the searchstring (not in expression, not in sql not in arcmap expressions etc....i tried em all, sql actually explains this)

The In string, in your case the attribute concatenated, is taken literally.

You either do a Like:

@Value(concatenated) like %@Value(name)% (the latter part shoud be made in the texteditor! not arithmic editor!)

Or

[regexp {@Value(name)} {@Value(concatenated)}] <>0

Instring works also, though i dont use that one often in this context.


robertr

That does not work with a attribute as the searchstring (not in expression, not in sql not in arcmap expressions etc....i tried em all, sql actually explains this)

The In string, in your case the attribute concatenated, is taken literally.

You either do a Like:

@Value(concatenated) like %@Value(name)% (the latter part shoud be made in the texteditor! not arithmic editor!)

Or

[regexp {@Value(name)} {@Value(concatenated)}] <>0

Instring works also, though i dont use that one often in this context.

@gio

 

Thank you for the answer. I really feel this is very far fetched and it does not make any sense.

 

Why let one chose that if it won't work?

 

 

The versions provided for you do not work either, unfortunately.

 

Why would the LeftValue work with @Value(MyColumn) and the RightValue not? as long as you are allowed to use even UserParameters, it should work.

 

 

There must be something I am not seeing here.

Another thought:

Do not concatenate the list and use the ListSearcher transformer.


I got a similar situation to yours. I ended up constructing my query string like this <variable> = 'Value 1' OR <variable> = 'Value 2' OR ....


Hi @robertr, this simplified workflow worked just fine, with FME 2017.1.2.1.

Make sure that every feature entered into the Tester has both "NAME" and "_concatenated".

Hi @robertr, this simplified workflow worked just fine, with FME 2017.1.2.1.

0684Q00000ArJk4QAF.png

Make sure that every feature entered into the Tester has both "NAME" and "_concatenated".
Hmm. The issue is that I have 3.600 rows in my shapefile that have the "NAME" field with different values. That is always a fixed file and it does not change. I do not want to continue with all the 3,600 rows but only those that have the "NAME" in the obtained list, which is a longer string separated by comas.

 

 

The other file (that is supposed to provide the list of names to filter by) can vary from day to day (you do not know which will be the elements in the list).

 

 

I obtain the list by doing:

 

0684Q00000ArMDkQAN.png

 

 

That is why I am looking for something that would work on any source file, with the end result being:

 

 

IF "NAME" in MY_LIST:     PASS the feature_shapefiles with that name ELSE:     FAIL the rest of feature_shapefiles

 

For example, if MY_LIST would contain only "Los Angeles", I would need it to pass only the feature_shapefile with name = "Los Angeles'. I never know though which will be the items in the list.

 

 

I hope I did not make this more fuzzy than it is.

I got a similar situation to yours. I ended up constructing my query string like this <variable> = 'Value 1' OR <variable> = 'Value 2' OR ....

I have too many to be able to do this but I understand the workaround.

 

Thanks for the reply.

 

 


Hi @robertr, this simplified workflow worked just fine, with FME 2017.1.2.1.

Make sure that every feature entered into the Tester has both "NAME" and "_concatenated".
I'm afraid that either use of Tester or list operations may not be suitable to accomplish the goal.

 

Assuming that there are these two source datasets:

 

  1. Shapefile dataset, each feature has attribute 'NAME'.
  2. Changeable dataset, each feature also has attribute 'NAME'.
the FeatureMerger in this mock-up workflow would output Shapefile features whose NAME exist in the second dataset, via the Merged port.

 

 

 


I'm afraid that either use of Tester or list operations may not be suitable to accomplish the goal.

 

Assuming that there are these two source datasets:

 

  1. Shapefile dataset, each feature has attribute 'NAME'.
  2. Changeable dataset, each feature also has attribute 'NAME'.
the FeatureMerger in this mock-up workflow would output Shapefile features whose NAME exist in the second dataset, via the Merged port.

 

 

 

Very interesting.

 

I need to check this out today and come back with a feedback. Appreciate the suggestion.

 

 


I'm afraid that either use of Tester or list operations may not be suitable to accomplish the goal.

 

Assuming that there are these two source datasets:

 

  1. Shapefile dataset, each feature has attribute 'NAME'.
  2. Changeable dataset, each feature also has attribute 'NAME'.
the FeatureMerger in this mock-up workflow would output Shapefile features whose NAME exist in the second dataset, via the Merged port.

 

 

 

@takashi

 

Yes, this indeed works. I am accepting this as a very good solution to the issue.

 

Amazing how one finds a way of accomplishing something with a different transformer.

@robertr

OK, I see it does work apparently.

And you did not merge the test-clause to your features, that would fail indeed.

The Both versions I posted work btw. I use them al the time. (of course not when you do not merge the data..)

I see not why it would be far fetched. Seems simple enough to me.


@robertr

OK, I see it does work apparently.

And you did not merge the test-clause to your features, that would fail indeed.

The Both versions I posted work btw. I use them al the time. (of course not when you do not merge the data..)

I see not why it would be far fetched. Seems simple enough to me.

Thanks for your time and patience!

 

 


Reply