Replace Problem

Posted on 2013-06-26
Last Modified: 2013-07-18
I have data in one of the fields I am reporting against as below

Will for John Smith
Will For John Blogg

I want to remove the Will for to just have the name left i.e. John Smith, John Blogg

I am using the formula below

replace(database_field, 'Will for ','')

When I use this I am left with

John Smith and Will For John Blogg, i.e. it still leaves the one with the capital F for For.

How can make this work so I am left with John Smith, John Blogg from the example data
Question by:halifaxman
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
  • 2

Expert Comment

ID: 39277719
It appears the formula is used not used in the group or details sections.  The formula field must be in the group or details section.  If the field is not group or details sections the formula is not run for each record.

Expert Comment

ID: 39277726
If you want to complete the replacement before crystal loads the data, you can use a t-sql statement to the database.  Here are instructions
LVL 48

Expert Comment

ID: 39277831
nest the replace function?

replace(replace(database_field, 'Will for ',''),'Will For ','')
Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

LVL 100

Accepted Solution

mlmcc earned 500 total points
ID: 39277977
You have to account for capitalization which Paul's comment does.  Do you potentially have other capitalization of the Will For?

You can also use

Replace({Database Field},"will for","",1,-1,1)

This specifies
Replace(Database Field, Search String, Replacement String, Start Position, Count, Case Sensitivity)

Count -1 means replace all occurrences
Case Sensitivity - 0 is case sensitive, 1 is for case insensitive

LVL 48

Expert Comment

ID: 39278072
@mlmcc - excellent!
Where does one find formal online doco for crystal functions these days?
LVL 100

Expert Comment

ID: 39278146
I don't know of an online help.  I use the help from Crystal installed on my machine.

LVL 48

Expert Comment

ID: 39278159
:( pity - thanks anyway

Featured Post

On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Hot fix for .Net Crystal Reports 10.2.3600.0 to fix problems with sub reports running on 64 bit operating systems ISSUE: Reports which contain subreports fail with error "Missing Parameter Value" DEPLOYMENT SERVER OS: Windows 2008 with 64 bi…
Hello everyone, Hope you find this as helpful as we did. We have on the company I work for an application built in Delphi V with Crystal Reports 8. We all know that Crystal & Delphi can be temperamental sometimes and the worst thing is, nearly…
I've attached the XLSM Excel spreadsheet I used in the video and also text files containing the macros used below.…

738 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question