1

Im using FME workbench and I have a file which has a field called '_substring4' and another file which has a field called 'Permit Details'.

I simply want to test whether or not the value in substring4, is contained in the value of Permit Details. Both fields are strings.

As an example

  • _substring4 = 27.2
  • Permit Details = Regional Permit number 27.2

Permit Details contains the substring '27.2' therefore should return true. This is just a simple SQL LIKE statement.

I'm currently using a Tester. If I put Permit Details as left Value, using LIKE and put '%27.2%' in the right value, it works. Great!

However when I replace the 27.2 with the field '_substring4', it doesn't work.

ie: The following works (Test passes). This works

However the following doesn't work. (Tester fails)

enter image description here

I've also attempted to use the StringSearcher transformer but I basically get the same problem - Whenever I use the field that contains the raw value it works, but attempts to use the field value fail. I also tried to change the Tester comparison type to 'Contains' - however this returns all features from the input, which is incorrect. ( I also thought that inverting the inputs was also the answer, but its not!)

I've also confirmed that the value of the field is coming through correctly by both writing it out to a file with a data type of string and also the FME Inspector.

I feel like the Tester isn't putting wildcards on the field, so if that's the solution, help in doing this would be great. Alternatively, if there is another mechanism, would be happy to hear it.

4
  • 2
    Switch the operator from 'Like' to 'Contains' in the Tester transformer will work.
    – Mapperz
    Commented Jul 14, 2021 at 3:07
  • Contains returns ALL features.....Again if i hardcode the value 27.2 in the contains statement, it works....... I tried this also sorry, ill amend the question to include this info.
    – nr_aus
    Commented Jul 14, 2021 at 3:09
  • turns out I was wrong again, inverting the inputs is not the solution. The Contains statement simply returns ALL values that are in the inputs.
    – nr_aus
    Commented Jul 14, 2021 at 3:32
  • im now thinking its a product bug, will advise once confirmed. Im using FME Build 18592 - FME 2018.1.2.1
    – nr_aus
    Commented Jul 14, 2021 at 3:44

1 Answer 1

0

The reason for it not working is that I was using two separate fields from separate feature sources. The TESTER transformer will accept the field names, but none of the values. Essentially leading to the situation where it is doing a does field contain 'blank' - which then returns everything.

The solution was to use the FeatureMerger to merge the data into a dummy data structure that contained all the fields and their values, that needed to be compared. Kudos to my college for pointing this one out.

So in summary - To my specific question - The Tester Transformer with a 'Contains' operator will work, under the condition that the fields being operated on are on a single incoming feature record.

Additionally, you may want to consider using the InlineQuerier as an alterntaive mechanism for doing queries on fields acros multiple inputs.

2
  • You can also use the FeatureMerger to compare values instead of using the Tester. Matched/NotMatched give you pretty much the equivalent to Passed/NotPassed on the Tester. i.e. you might not need to use both. The Matcher, DuplicateRemover, and FeatureJoiner would let you do similar things. I agree that the InlineQuerier is another way to go, especially for anyone who is into SQL. Anyway, I'm glad you got this sorted. Commented Jul 15, 2021 at 19:02
  • yer looks like most of the FME documentation (even the FeatureMerger) suggests that its more efficient to use SQLExector or InlineQuerier instead so thats ok with me.
    – nr_aus
    Commented Jul 16, 2021 at 0:54

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.