Solved

Replace Problem

Posted on 2013-06-26
7
178 Views
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
0
Comment
Question by:halifaxman
  • 3
  • 2
  • 2
7 Comments
 
LVL 9

Expert Comment

by:BlueYonder
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.
0
 
LVL 9

Expert Comment

by:BlueYonder
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 http://hexcentral.com/articles/crystal-sql.htm.
0
 
LVL 48

Expert Comment

by:PortletPaul
ID: 39277831
nest the replace function?

replace(replace(database_field, 'Will for ',''),'Will For ','')
0
Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

 
LVL 100

Accepted Solution

by:
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


mlmcc
0
 
LVL 48

Expert Comment

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

Expert Comment

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

mlmcc
0
 
LVL 48

Expert Comment

by:PortletPaul
ID: 39278159
:( pity - thanks anyway
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Crystal Reports: 5 Tests for Top Performance It is complete, your masterpiece report.  Not only does it meet your customer’s expectations, it blows them out the water, all they want is beautifully summarised and displayed in a myriad of ways. …
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…
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…
You have products, that come in variants and want to set different prices for them? Watch this micro tutorial that describes how to configure prices for Magento super attributes. Assigning simple products to configurable: We assigned simple products…

706 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

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now