Skip to main content
Solved

How to find "(" or ")" using @FindString in AttributeManager?

  • December 21, 2021
  • 1 reply
  • 674 views

Forum|alt.badge.img

Hello!

I'm trying to use the following to find the position of a character/string in one of my attributes:

@FindString(@Value(ColumnName),TEXT,1,caseSensitive=TRUE)

When I replace TEXT with the text I am searching for, this works as expected, except for when the text to be found is a parenthesis, i.e. ( or ). In that case, the function interprets the parenthesis as the start or end of the function's arguments. I tried to escape the parenthesis using a forward slash (as suggested by the FindString() documentation to escape a quotation mark) as well as by surrounding it with quotation marks (as suggested by the FindString() documentation to escape a comma), but neither of these work.

How can I properly escape ( and ) inside the function arguments?

Thank you!

Best answer by hkingsbury

@FindString(@Value(test),"(",1,caseSensitive=TRUE)

This is the correct syntax, note that it does show as an error in a AttributeCreator. Do note that FME uses zero indexes for searching/counting/lists. So setting the StartIndex to '1' is actually starting at the second character. So if your string starts with a '(' then it won't find it.

 

Another option is to also look at the StringSearcher transformer

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

1 reply

hkingsbury
Celebrity
Forum|alt.badge.img+54
  • Celebrity
  • Best Answer
  • December 21, 2021
@FindString(@Value(test),"(",1,caseSensitive=TRUE)

This is the correct syntax, note that it does show as an error in a AttributeCreator. Do note that FME uses zero indexes for searching/counting/lists. So setting the StartIndex to '1' is actually starting at the second character. So if your string starts with a '(' then it won't find it.

 

Another option is to also look at the StringSearcher transformer


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