Search code examples
business-intelligencebusiness-objects

Matching string for patters via MATCH?


Is there a function in Business Objects Web Intelligence (Version 2010) to test if a string contains a constant? I know the MATCH() function can be used to test a string for a pattern, similar to how SQL implements a LIKE condition.

For example:

myString = 'abc,def,ghi'
myString2 = 'def,ghi,jkl'

Both string variables above contain the constant 'def', but is there a function to test for this rather than using:

=IF(MATCH([Dimension];"def") OR MATCH([Dimension];"*def") 
  OR MATCH([Dimension];"def*") OR MATCH([Dimension];"*def*"))
//Do something

I have looked through the functions and formulas manual and haven't found what I was looking for, hence, here I am.


Solution

  • MATCH([Dimension];"*def*")) will produce the result you need. The wildcard will match the beginning of the string.

    Alternatively, you can use Pos():

    =Pos("def abc ghi";"def")
    returns 1

    =Pos("def abc ghi";"abc")
    returns 5

    =Pos("def abc ghi";"xyz")
    returns 0