Avatar of Mark Wilson
Mark Wilson asked on

Problems with REPLACE


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

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
Crystal Reports

Avatar of undefined
Last Comment
Mike McCracken

8/22/2022 - Mon
Ido Millet

Log in or sign up to see answer
Become an EE member today7-DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform
Sign up - Free for 7 days
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.
See how we're fighting big data
Not exactly the question you had in mind?
Sign up for an EE membership and get your own personalized solution. With an EE membership, you can ask unlimited troubleshooting, research, or opinion questions.
ask a question
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.

All of life is about relationships, and EE has made a viirtual community a real community. It lifts everyone's boat
William Peck