Skip to main content
Solved

Search entire attribute table for the existence of a particular string


abysmal-ukulele
Contributor
Forum|alt.badge.img+2

Hi I have a feature service that is apart of a Survey123 survey. The survey will indicate if something has failed in a variety of ways.

 

I currently have a workspace that has a testfilter transformer looking through 50 different attribute columns looking for the word Fail. Then from each output port there is an action that is taken. Is there a transformer that I could use to search the whole attribute table for the word fail instead?

 

Thanks!

Best answer by ebygomm

abysmal-ukulele wrote:

Hi @ebygomm​, I'm afraid I'm really new to this. The line of code is what I would type into what? Am I using a tester transformer with that code?

image

View original
Did this help you find an answer to your question?

6 replies

daveatsafe
Safer
Forum|alt.badge.img+19
  • Safer
  • March 13, 2023

Hi @abysmal-ukulele​,

Please have a look at the FME Hub transformer AttributeValueSearcher. I think it is exactly what you are looking for.


ebygomm
Influencer
Forum|alt.badge.img+38
  • Influencer
  • March 14, 2023

If the attribute will only contain the word Fail and nothing else you could use an attributevalidator. Test for Contains Regex and only pass items where the attribute does not equal Fail. 

^(?!Fail$).*$

 Any features with an attribute equalling Fail will pass through the Failed port, the attributes containing the word fail will be detailed in a list

 

I think this regex should work if you just want to look for the word Fail but probably needs checking!

^(?!.*\bFail\b).*$

 


abysmal-ukulele
Contributor
Forum|alt.badge.img+2
ebygomm wrote:

If the attribute will only contain the word Fail and nothing else you could use an attributevalidator. Test for Contains Regex and only pass items where the attribute does not equal Fail. 

^(?!Fail$).*$

 Any features with an attribute equalling Fail will pass through the Failed port, the attributes containing the word fail will be detailed in a list

 

I think this regex should work if you just want to look for the word Fail but probably needs checking!

^(?!.*\bFail\b).*$

 

Hi @ebygomm​, I'm afraid I'm really new to this.  The line of code is what I would type into what? Am I using a tester transformer with that code?


ebygomm
Influencer
Forum|alt.badge.img+38
  • Influencer
  • Best Answer
  • March 14, 2023
abysmal-ukulele wrote:

Hi @ebygomm​, I'm afraid I'm really new to this. The line of code is what I would type into what? Am I using a tester transformer with that code?

image


abysmal-ukulele
Contributor
Forum|alt.badge.img+2
abysmal-ukulele wrote:

Hi @ebygomm​, I'm afraid I'm really new to this. The line of code is what I would type into what? Am I using a tester transformer with that code?

Thanks again @ebygomm​  I like your suggestion. I'm debating how to create my workspace. I could use the attribute validator or I have also created a TestFilter that has close to 50 cases. I'm debating which of the two methods would be more sustainable to maintain vs. will be processed faster.


abysmal-ukulele
Contributor
Forum|alt.badge.img+2
daveatsafe wrote:

Hi @abysmal-ukulele​,

Please have a look at the FME Hub transformer AttributeValueSearcher. I think it is exactly what you are looking for.

Hi @daveatsafe​ unfortunately I can't use this on our production environment. But I think you're right the transformer looks promising. Cheers!


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