Skip to main content
Question

Tester - using IN Operator on Concatenated List - Not working


robertr
Contributor
Forum|alt.badge.img+6

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:

14 replies

erik_jan
Contributor
Forum|alt.badge.img+17
  • Contributor
  • February 8, 2018

Have you tried _concatenated CONTAINS NAME?


robertr
Contributor
Forum|alt.badge.img+6
  • Author
  • Contributor
  • February 8, 2018
erik_jan wrote:

Have you tried _concatenated CONTAINS NAME?

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

 

 


gio
Contributor
Forum|alt.badge.img+15
  • Contributor
  • February 8, 2018

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
Contributor
Forum|alt.badge.img+6
  • Author
  • Contributor
  • February 8, 2018
gio wrote:

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.

erik_jan
Contributor
Forum|alt.badge.img+17
  • Contributor
  • February 8, 2018

Another thought:

Do not concatenate the list and use the ListSearcher transformer.


Forum|alt.badge.img
  • February 8, 2018

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


takashi
Influencer
  • February 8, 2018

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".

robertr
Contributor
Forum|alt.badge.img+6
  • Author
  • Contributor
  • February 8, 2018
takashi wrote:

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.

robertr
Contributor
Forum|alt.badge.img+6
  • Author
  • Contributor
  • February 8, 2018
kuanglee wrote:

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.

 

 


takashi
Influencer
  • February 9, 2018
takashi wrote:

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.

 

 

 


robertr
Contributor
Forum|alt.badge.img+6
  • Author
  • Contributor
  • February 9, 2018
takashi wrote:
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.

 

 


robertr
Contributor
Forum|alt.badge.img+6
  • Author
  • Contributor
  • February 9, 2018
takashi wrote:
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.

gio
Contributor
Forum|alt.badge.img+15
  • Contributor
  • February 9, 2018

@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
Contributor
Forum|alt.badge.img+6
  • Author
  • Contributor
  • February 9, 2018
gio wrote:

@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!

 

 


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings