Link to home
Start Free TrialLog in
Avatar of Mark Wilson
Mark Wilson

asked on

Problems with REPLACE

CR2008

I am using the following formula in a report, to replace certain

if {Command.narrative} like '*format*' then replace({Command.narrative},'format',' ') else
if {Command.narrative} like '*nostock*' then replace({Command.narrative},'nostock',' ') else
{Command.narrative}

The problem is that the first line of the formula works but the 2nd line doesn't i.e. it doesn't replace any words with nostock in with ''.

Any help would be appreciated
ASKER CERTIFIED SOLUTION
Avatar of Ido Millet
Ido Millet
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Mike McCracken
Mike McCracken

Another thing that might be happening is the case is an issue.

Replace(Replace({Command.narrative},'format',' ',,1),'nostock',' ',,1)

The 1 tells replace to do a non-case sensitive replace

Your method fails because you have the second test in the else clause so it is only tested for strings that don't have format in them.

mlmcc