cancel
Showing results for 
Search instead for 
Did you mean: 

Replacing multiple strings by the same value

former_member318041
Participant
0 Kudos
1,033

Hi all,
I am working with "SAP BusinessObjects Business Intelligence 4.2" and have the following problem. I need to replace certain strings within a variable by another string.
E.g. if the strings is "abc", "odo" or "xyz", it needs to be replaced by ths string "TEST".

If the content of my variable is "ddddddabcddddd", it should result in "ddddddTESTddddd".
If the content of my variable is "ddddddododdddd", it should also result in "ddddddTESTddddd".
If the content of my variable is "ddddddxyzddddd", it should also result in "ddddddTESTddddd".
...
It is easy to do this, if there is just one string to be replaced, but in my case there are about 15 strings that need to be replaced in the described way.

Any ideas?
View Entire Topic
ayman_salem
Active Contributor
0 Kudos

Define the following variable:

M_R: =If (Match([your dim]; ("*abc*"))) Then Replace([your dim]; "abc"; "TEST") Else if (Match([your dim]; ("*odo*"))) Then Replace([your dim]; "odo"; "TEST") Else if (Match([your dim]; ("*xyz*"))) Then Replace([your dim]; "xyz"; "TEST") Else [your dim]

...

Then use it in your table

....

hopefully that helps

former_member318041
Participant
0 Kudos

Thank you!

It is not as easy as I expected it to be - thanks again and have a great remaining day!

Henning