Solved

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

  • 21 December 2021
  • 1 reply
  • 79 views

Badge

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!

icon

Best answer by hkingsbury 21 December 2021, 20:16

View original

1 reply

Userlevel 5
Badge +29
@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

Reply