[Last Call] Learn about multicloud storage options and how to improve your company's cloud strategy. Register Now

x
Solved

Replace Problem

Posted on 2013-06-26
Medium Priority
206 Views
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
Question by:halifaxman
[X]
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

LVL 9

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.
0

LVL 9

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

LVL 49

Expert Comment

ID: 39277831
nest the replace function?

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

LVL 101

Accepted Solution

mlmcc earned 2000 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 49

Expert Comment

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

LVL 101

Expert Comment

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

mlmcc
0

LVL 49

Expert Comment

ID: 39278159
:( pity - thanks anyway
0

Featured Post

Question has a verified solution.

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

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. …
I hate sub reports and always consider them the last resort in any reporting solution.  The negative effect on performance and maintainability is just not worth the easy ride they give the report writer.  Nine times out of ten reporting requirements…
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…
Sometimes it takes a new vantage point, apart from our everyday security practices, to truly see our Active Directory (AD) vulnerabilities. We get used to implementing the same techniques and checking the same areas for a breach. This pattern can re…
Suggested Courses
Course of the Month12 days, 15 hours left to enroll

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

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