Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is it possible to use one replace function to replace multiple strings in one field?

In my report I need to use the built-in replace function to replace for example "a" with "b" and "c" with "d".

When I just use 2 functions like this: Replace(Fields!field1.Value, "a", "b") & Replace(Fields!field1.Value, "c", "d") I get the text from the field twice in my report.

Is it possible to do this? Maybe nest two replace functions? I'm new to reporting services so I could be missing a very obvious solution to this.

Note: I would write my own code to do this but the report is for Microsofts Dynamics CRM 2011 which doesn't allow custom code in a report.

like image 462
boert03 Avatar asked Sep 30 '11 08:09

boert03


People also ask

How do you replace multiple values in a string?

Show activity on this post. var str = "I have a cat, a dog, and a goat."; str = str. replace(/goat/i, "cat"); // now str = "I have a cat, a dog, and a cat." str = str. replace(/dog/i, "goat"); // now str = "I have a cat, a goat, and a cat." str = str.

How do you replace multiple strings in Excel?

Multiple find and replace in Excel with Substring tool To do mass replace in your worksheet, head over to the Ablebits Data tab and click Substring Tools > Replace Substrings. The Replace Substrings dialog box will appear asking you to define the Source range and Substrings range.

How do you replace multiple strings in Python?

Replace multiple different characters: translate()Use the translate() method to replace multiple different characters. You can create the translation table specified in translate() by the str. maketrans() . Specify a dictionary whose key is the old character and whose value is the new string in the str.

How do you replace multiple values in Excel?

=SUBSTITUTE(A2, "1", "2") - Substitutes all occurrences of "1" with "2". Note. The SUBSTITUTE function in Excel is case-sensitive. For example, the following formula replaces all instances of the uppercase "X" with "Y" in cell A2, but it won't replace any instances of the lowercase "x".


1 Answers

You have to nest the function's

For example to replace 1 with a and 0 with b you can write the expression below

=Replace(Replace(Fields!field1.Value,"1","a"),"0","b")

like image 73
niktrs Avatar answered Nov 15 '22 09:11

niktrs